TheUndefined Posted October 3, 2006 Share Posted October 3, 2006 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. Quote Link to comment Share on other sites More sharing options...
effigy Posted October 3, 2006 Share Posted October 3, 2006 Have you scanned through [url=http://httpd.apache.org/docs/2.2/misc/perf-tuning.html]this[/url]? It sounds like "Process Creation" may be your area of concern. Can you watch and see how many children you have waiting/spawning? Quote Link to comment Share on other sites More sharing options...
TheUndefined Posted October 3, 2006 Author Share Posted October 3, 2006 Thx for the reply, i'll read the site now.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. Quote Link to comment Share on other sites More sharing options...
TheUndefined Posted October 3, 2006 Author Share Posted October 3, 2006 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? Quote Link to comment Share on other sites More sharing options...
effigy Posted October 3, 2006 Share Posted October 3, 2006 I'll check my configuration when I get home--I think I use a longer keep alive. Can most of the visitors on your site do what they need within 15 seconds? Quote Link to comment Share on other sites More sharing options...
TheUndefined Posted October 4, 2006 Author Share Posted October 4, 2006 [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 Quote Link to comment Share on other sites More sharing options...
effigy Posted October 6, 2006 Share Posted October 6, 2006 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 5MinSpareServers 5MaxSpareServers 10 MaxClients 15 MaxRequestsPerChild 10000 </IfModule>Timeout 300KeepAlive OnMaxKeepAliveRequests 500KeepAliveTimeout 15[/tt] Quote Link to comment Share on other sites More sharing options...
TheUndefined Posted October 6, 2006 Author Share Posted October 6, 2006 Ok, thx for checkingI 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.