1

I'm having some problems with my Server. It's getting quite a bit of traffic and is very slow, and sometimes inaccessible by my users.

Here are the server specs:

CPU: Intel(R) Xeon(R) CPU E5620 @ 2.40GHz  -  16 Processors
RAM: 2GB

The Values for the Apache Config are:

StartServers: 5
MaxSpareServers: 10
MinSpareServers: 5
MaxClients: 150
ServerLimit: 256
MaxRequestsPerChild: 1000
KeepAlive: On
KeepAliveTimeout: 5
MaxKeepAliveRequests: 100
TimeOut: 300

What would be optiminal values for a server of my configuration to support the maximum amount of users at a reasonable speed without killing the server!

Thank you.

  • What services are you running aside from apache? Also what is your typical RAM utilization? 2GB across 16 CPU seems a bit light unless your running a simple file server, Itend to go 1GB per 4 CPU for lighter duty servers such as web or print servers. Lemme know and we'll see if we can help you out. Your settings look fairly standard and with only ~9 clients per CPU concurently there's over 200Mhz/client so I doubt that is hurting but tweaking that up or down can help find the tipping point for lots of servers. –  Feb 18 '11 at 01:29
  • Nothing other than some PHP scripts (light image manipluation and heavy use of mySQL) –  Feb 18 '11 at 02:56
  • Ok Moe, the PHP shouldn't be an issue but SQL can become a pig if your using cascading updates or if requests have to be filtered at multiple levels. –  Feb 18 '11 at 03:46
  • If your server is at max connections each client has at least 200Mhz, and 1.2 MB L2 which should suffice but if the request involve any kind of report generation other than raw or slightly formatted requests like a search engine output the 128MB per core might be tight considering that's only 13.5MB ea client. also image manipulation can eat up RAM in a hurry. Monitor your RAM use, if it's hitting the page file at all try stuffing in enough ram to eliminate the page, if not we'll have to look at stats like number of threads running and try to determine L2 usage. –  Feb 18 '11 at 03:50
  • One last thought, what sort of RAID controller are you using and what kind of drive array is on it? If none of the above show obvious reasons it's quite possible the "hard drive" is holding up progress by taking too long to retrieve requests, thus holding up all processes in cue waiting for the array. Pretty easy to run a drive channel monitor and see how much bandwidth is in use during heavy use times. Remember the channel the drive is on PCIEx1/4/16 has as much to do with performance as the number and individual performance of the drives. –  Feb 18 '11 at 03:55

2 Answers2

2

Problem is you have only 2gb of RAM and you set MaxRequestsPerChild to fairly high value.

Your configuration basically says you can have up to 256 simultaneous apache threads (each serving 1 request) and each of those threads will be serving 1000 requests before it's recycled and replaced with new thread.

While processing 1000 requests, memory footprint of that thread will grow too big for your 2GB system.

Other thing I'd advise is to check how much statical content you deliver, how much is dynamical (php). You can check that by looking at logs, or analyzing mod_Status (apache2ctl fullstatus) output.

If you have a lot of statical content, images and such I would recommend to put webservers like nginx infront of apache that handle statical content much better and just proxy non statical content requests to apache on some locally bind different port.

Hrvoje Špoljar
  • 5,245
  • 26
  • 42
0

The "slowing down" comes ususally from congestion on the web server (to many clients) or from the use of swap.

To prevent congestion, the KeepAliveTimeout could be lowered between 1 and 3. It will free more quickly the server from clients and will allow more answer do different clients in the same time.

You should check that your server never swap, if it is, you should lower the MaxClients (yes, it will prevent some client requests but at least, the connected clients will have a response in a shorter time and will free the server resources quickly). If you have some free memory when all the 150 clients are connected, you can carefully raise the MaxClient number.

If you use Linux you can try to lower the ThreadStackSize, it will help the kernel with the memory management. I have lowered it without problem to 512Ko on my own servers :

ThreadStackSize 524288

In any case, you should try to setup graphs of you server activity in order to mesure accurately the usage of your server. I like munin which is really easy to setup and provide very pertinent graphs by default, but there is also cacti, collectd with ddraw and a lot of others ...

jon_d
  • 683
  • 4
  • 7