Jump to content

First request slow, next fast.


TheUndefined

Recommended Posts

Hi,
[b]In summary:[/b] The first request i make to the server is slow, the next requests are fast.

[b][u]Some context:[/u][/b]
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.

[b][u]What do i already know?[/u][/b]
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.

[u][b]What i'd like to know[/b][/u]
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.
Link to comment
Share on other sites

I've followed your link and started using mod_status.
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! [url=http://httpd.apache.org/docs/2.2/mod/mod_status.html]http://httpd.apache.org/docs/2.2/mod/mod_status.html[/url]

Any comments on what's a normal reaction to deal with this are still welcome, or is setting MaxClients to 100 an OK sollution?
Link to comment
Share on other sites

[quote author=effigy link=topic=110369.msg446118#msg446118 date=1159894346]
Can most of the visitors on your site do what they need within 15 seconds?
[/quote]

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! :P thx alot
Link to comment
Share on other sites

Sorry for the delay. My keepalive is actually 15 as well. Keep in mind that this is my small, personal server. I used to get more traffic when I had a site running, but I've emptied everything out for an eventual redesign. I'm sure I'll need to tweak these when that time comes :)
[tt]
<IfModule prefork.c>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 15
MaxRequestsPerChild 10000
</IfModule>
Timeout 300
KeepAlive On
MaxKeepAliveRequests 500
KeepAliveTimeout 15
[/tt]
Link to comment
Share on other sites

Ok, thx for checking
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,
cya
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.