Apache tuning and memory footprints

From: Date: Wed, 11 Oct 2000 20:34:53 +0000
Subject: Apache tuning and memory footprints
Groups: php.general 
Request: Send a blank email to php-general+get-19702@lists.php.net to get a copy of this message
I'd appreciate hearing the experience of others or any definitive links to information about optimum Apache config settings for the best performance on a specific host configuration (memory, CPU, etc.). I'm consulting on a site that seems to have everything going for it yet is getting bogged down. It runs Apache 1.3.12, PHP 4.02, Red Hat Linux 6.2, has 256MB of Ram, and a 600mHz CPU. The site has bursts of activity where hundreds of users are going to try to connect in a short time window. It is sluggish on a few pages that make some mySQL queries, but the database (on a remote host) is running well, and the queries and PHP calls are all well-written and the database is appropriately indexed. I've worked on similar configurations in the past with no trouble. My first thought was the tcp/ip input queues were getting filled up too fast, so I bumped SOMAXCONN up to 32, no help there. My next thought was that the filesystem was going into swap, because during the brief periods of intense activity, the server will eventually have a high load average and users will start to time out. I figured keeping MinSpareServers, MaxSpareServers, and StartServers all at the same number, with the thought that the expense of starting them up after times of low activity might be a factor. My main question, which I've never seen hard figures on, is how to estimate the right mix of start servers and MaxClients, based on available memory. Looking at the output of top (which I'm not sure how much I trust), I see a SIZE for httpd to be around 4500, RSS around 3200, and SHARE around 1600. Isn't RSS the amount of physical (non-shared) memory per client? If it is 3.2MB per, then 100 users would want 320MB, which is more than the physical memory I have. The default MaxClients is 150, which doesn't seem right. But it has been this number for a long time, and I doubt most users would have the physical memory for it, if the way I'm interpreting things is correct. Would it be better to drop MaxClients down to keep closer to the amount of physical memory available? If so, what would the downside be? And what about having a high number for StartServers and spare servers? This host is used only for Apache, no mail or other non-essential services are running. I'm sure there are more details on tuning to match physical memory, but I've exhausted all the sources I can think of. thanks, Phil

« previous php.general (#19702) next »