Date: Fri, 10 Dec 2010 06:37:13 +0000 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: Laszlo Nagy <gandalf@shopzeus.com> Cc: questions@freebsd.org, danieleff@gmail.com Subject: Re: What is loading my server so much? Message-ID: <4D01CA99.9020706@infracaninophile.co.uk> In-Reply-To: <4D00BDF8.6020206@shopzeus.com> References: <4D00BDF8.6020206@shopzeus.com>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig50929FA314BAB869CCC0AA72 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable 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 can support. 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 hardware. Cheers, Mstthew --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matthew@infracaninophile.co.uk Kent, CT11 9PW --------------enig50929FA314BAB869CCC0AA72 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk0ByqAACgkQ8Mjk52CukIx9awCfdRZAjdmSkbPXuX+zOkthi6kQ 7cQAnAsR/awYyqE9q6NuQfI/K57QaIG8 =XO3v -----END PGP SIGNATURE----- --------------enig50929FA314BAB869CCC0AA72--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4D01CA99.9020706>