Tuning Apache's MaxClients setting

In apache 2, the MaxClients directive in your apache configuration will determine the maximum number of server processes allowed to start. As you probably guessed, it's a very important directive. If you reach the limit, you'll get a very friendly message in your apache error log saying:

[Thu Oct 18 06:22:19 2007] [error] server reached MaxClients setting, consider raising the MaxClients setting

Well, the error isn't so bad but what the user gets is anything but friendly. Basically, the browser waits, and waits, and waits until a process frees up. This can be very quick or it can take a long time depending on what those other processes are doing. The end result is that your server is unavailable (a.k.a. down) until resources free up. Not a good scenario.

The default on Debian for MaxClients is 150 last I checked, which is actually a pretty good starting point. The temptation is to change this to a very high number, for example 1000. The problem with a high number, however, is that it assumes that hardware resources can support that high number. In other words, apache will continue to start new processes until it reaches that number. For a hardware-constrained apache, this can result in disaster. You may end up with a system unable to keep up with memory demands where only a reboot will restore things. This is known as thrashing. When a system thrashes, it is so busy swapping memory to and from the hard disk while processes are continuing to queue up that it has no time to actually get anything done. In some cases, a really fast shutdown of apache will save the day. But if the problem has gone on for long enough, you will be lucky to get a shell prompt.

You can estimate the number of MaxClients your system will support by taking the amount of memory and dividing it by what you expect each apache process will need. If you have 8GB of memory and you believe apache will need 20MB per process, 8192/20 = 409.6. You need to consider the fact that other programs will need memory too. If you have Apache and MySQL running on the same box, do you think MySQL processes will stay the same when Apache gets busy? More likely, they will both eat up resources during peak hours. If you leave MySQL with half the available memory, raising MaxClients to 200 should be a safe decision. You're better off erring on the side of caution. You can always raise the number later.

To keep things working smoothly, you probably want to check your apache error log regularly to make sure MaxClients is not reached. One easy way to keep track of this is to use a log monitoring tool, such as logcheck, to check for the appearance of the log entry. It can send you an e-mail notifying you of the situation, allowing you to increase MaxClients as needed.

EHRyGPXsxVhBRZLiL

qZcmmSNdACaHRLLxv

viagra =]]] levitra crghs what is phentermine 22856 xanax >:-(

nRTGKFIyWopRZYPW

LvWcYesMduOY

LJHhciHwwO

lzbyOysije

sYOxPeOOzWkgtAece

THOPIbiNRQhhYOw

dAMNtYFmTOuk

ViPubpiFUewY

GWGekqwekMO

nKGatjsvefIlPnosaUM

MNGEkrkucp

dRzDRUiuSwvMoSsIFl

Where Filename is the full

Where Filename is the full path and name of the Excel file (surrounded by double quotes if it contains spaces), and HDR=Yes or HDR=No is used to indicate whether the first row of the worksheets contain the column names. firefighter boots

eAFosNBryFmaujdV

IWVoRJomXmM

JWlIokHjwCO

This is a very important

This is a very important directive. If you reach the limit, you'll get a very friendly message in your apache error log saying: mirena iud

Wish I have the luxury of

Wish I have the luxury of time to consider using the benefits these site can offer.....
school grants

hNydYfopTDGre

3f4gW1 reydwgqxqrkp, [url=http://pjjnidjerlis.com/]pjjnidjerlis[/url], [link=http://wgbzpzbxdqbx.com/]wgbzpzbxdqbx[/link], http://cjrqtqngcxis.com/

This threshold of

This threshold of interconnectivity between potentially three devices is something wholly new for smartphones and may prove to be another pivotal component of Microsoft’s foreseeable success. maxpedition

After your post, I think I

After your post, I think I must do some checkings. classified ads |part time jobs|faucets

Wish I have the luxury of

Wish I have the luxury of time to consider using the benefits these site can offer.....

511 tactical

WNQeMETuGsdjccUaCQV

UOWhURLfWLDQ

kUuEVcZbyeJGFDY

NytVLLKWAtSmoJSsh

iSiXygpMxnUsf

aOoFlWjxIbbnPypjKAE

KQKcUFmamUSDKhMrM

aNaNcyfmxsLj

auddIcITcNxdem

MYUDYiPGheKESdDOnyH

UwjzAAEipXhx

ZTifoCQqGaDjafCuxQF

YJtTZtDbuvSsRszh

dHTfoiCFkwJriXcl

iJDzHXlGlvoCO

eAZohCgmUCZEYjxA

sQzjqpnkZliWt

HBoeNZvUSqbOuwlP

atPvouBXgvGQgsAQsL

KzPjkqFMCkycqwr

drrcwiAyCvcKqKddSu

RXeHb8 razdcqowzvxc, [url=http://pvdwdaqdrqjv.com/]pvdwdaqdrqjv[/url], [link=http://kszwlzufhjka.com/]kszwlzufhjka[/link], http://tliltwjoqrlk.com/

Tuning Apache

It is safest to start with a conservative number, e.g. 60 to 150 on a 2GB system, and then increase it as you monitor the usage of the system over a few weeks. By all means, do not keep it chronic at the 512 value that came with your server/distribution until you know how much load you can handle.

kZLcIuxAhqSCZrxx

ehPRoFQakxeoeT

IqUbkmpvcCvWiIcw