First request slow, next fast.
Posted 03 October 2006 - 01:17 PM
In summary: The first request i make to the server is slow, the next requests are fast.
I'm running Apache2 on Debian.
There are a couple of Named VirtualHosts running on the server.
There is no Listener line in the conf, so it's listening on both (2 IP's) its interfaces on port 80.
HostnameLookups is off in the conf file.
There is a "NameVirtualHost [first-IP]" in the conf.
All the VirtualHosts are named with an IP address to prevent DNS problems.
All VirtuaHosts have a ServerName entry to prevent DNS problems.
Not using SSL.
What do i already know?
The problem gets worse (the initial wait time) when the server gets a heavyer load.
While the initial connection is waiting i can see the size of the header data in the Recv-Q field when doing netstat.
There is some reverse DNS resolving being done, but not with every request, don't know what's causing it.
There are no hostnames stored in the log files, only IP addresses.
There is no relevant information in the error log.
What i'd like to know
A way to make sure/exclude that it's a DNS problem.
Other hypotheses on what might be causing this.
Things i should look after and include here.
I'm already debugging this quite a while now, and any help is seriously welcome.
I'll be checking the forum regulary to give quick replies.
Posted 03 October 2006 - 02:14 PM
Some info already:
I'm using prefork.c and MaxClients is set to 20 and there are 20 apache processes running as www-data and one as root, so that seems ok.
I'll post what i find out with the link you gave.
Posted 03 October 2006 - 02:56 PM
I saw that the 20 processes had the status "K" Keepalive (read).
The keepalive timeout is set to 15 seconds, i suppose this is causing that.
I've now set MaxClients to 100 and my problem is solved. Since there are enough connections available for new visitors.
I'll toy around a bit more with the keepalive and the MaxClient setting.
For anyone reading this with similar problems use mod_status! http://httpd.apache....mod_status.html
Any comments on what's a normal reaction to deal with this are still welcome, or is setting MaxClients to 100 an OK sollution?
Posted 04 October 2006 - 07:15 AM
Can most of the visitors on your site do what they need within 15 seconds?
They probebly can't, well or, many can't. But if the keepAlive is "hijacking" my connections i can only put it higher if i can affort to set MaxClients to a relatively equaly high number. I've been googling a bit and a MaxClients of 250/300 doesn't seem all that uncommon. I'll try getting a view on how long visitors are staying and ajust the keepalive/MaxClients accordingly.
Still interested in what you've got set tho, but after that i think i'm closing this thread, SOLVED! thx alot
Posted 06 October 2006 - 02:31 AM
Posted 06 October 2006 - 08:02 AM
I found out that setting MaxClients to 256 (need to recompile to go higher) isn't all that uncommon.
Apache manages it anyway, if it doesn't need 256 it doesn't open them. I might still put it to 150 or something, since the CPU is usualy at its limit then.
It can take 700 plain html requests per second now and 70 requests/second to a rather demanding php scirpt.
It's just CPU holding me back now, and that's ok with me, i can upgrade when needed.
So, i'm not gonna be following this thread anymore, thx for the help,
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users