What is loading my server so much?
m.seaman at infracaninophile.co.uk
Fri Dec 10 06:37:27 UTC 2010
On 09/12/2010 11:31, Laszlo Nagy wrote:
> Today something happened. Number of http processes went up to 200. As a
> result, number of connections to database also went up to 200, and the
> web server is now refusing clients with "Cannot connect to database"
> messages (coming from PHP).
This is a classic scenario. Some burst of traffic causes your apache to
spawn more child processes than will all fit in RAM at one time.
Consequently, the system starts to swap. Swapping kills performance.
This slows everything down so much that there are always requests
waiting for apache to process, so apache will never find any idle
children to kill off. Result misery.
The answer is to limit the number of child processes apache will spawn.
Decide how much of your available RAM you can devote to Apache. Look at
top(1) to find the maximum size apache processes grow to. The ratio of
those two sizes is the maximum number of apache processes your system
Limiting the total number of apache processes sounds counter-intuitive.
What happens when you get sufficient traffic that apache maxes out? Web
queries will generally be queued up until there's an apache child free
to handle them. Generally that will take from a few 10s of milliseconds
on up -- although if you're regularly getting into a state where your
webserver takes seconds to answer, then it's time to get more beefy
Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard
PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate
JID: matthew at infracaninophile.co.uk Kent, CT11 9PW
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20101210/87845659/signature.pgp
More information about the freebsd-questions