Discussion:
Apache2 processes
Simon
2010-10-07 08:30:38 UTC
Permalink
Hi ppls...

We have apache2/php5 running on debian etch... i think just a pretty
standard config, running multiple vhosts - both name and IP based. The
issue is is that every now and again, the apache processes spike up to
210+ ish and the server eventually stops responding. An apache restart
solves this issue... but we are solving a problem with a workaround
rather than actually looking and understanding what is going wrong.

I have been reading thru lots of intenets and i'm a little lost.. If
anyone can give me some clarity and a place to start i would be most
grateful!...

Many thanks!

Simon

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
steve
2010-10-07 09:19:55 UTC
Permalink
Post by Simon
Hi ppls...
We have apache2/php5 running on debian etch... i think just a pretty
standard config, running multiple vhosts - both name and IP based. The
issue is is that every now and again, the apache processes spike up to
210+ ish and the server eventually stops responding. An apache restart
solves this issue... but we are solving a problem with a workaround
rather than actually looking and understanding what is going wrong.
I have been reading thru lots of intenets and i'm a little lost.. If
anyone can give me some clarity and a place to start i would be most
grateful!...
Many thanks!
Simon
First thing I'd do is to upgrade to a supported os!

Hopefully you've got separate logfiles for the sites... work out which
site is causing problems. I'd also put up some monitoring software - cacti,
munin or similar and look for other patterns... a problem with mysql
connections can cause this... and a default mysql install is extremely
restrictive.

hth,

Steve

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Simon
2010-10-07 20:48:03 UTC
Permalink
Post by steve
Post by Simon
Hi ppls...
We have apache2/php5 running on debian etch... i think just a pretty
standard config, running multiple vhosts - both name and IP based. The
issue is is that every now and again, the apache processes spike up to
210+ ish and the server eventually stops responding. An apache restart
solves this issue... but we are solving a problem with a workaround
rather than actually looking and understanding what is going wrong.
I have been reading thru lots of intenets and i'm a little lost.. If
anyone can give me some clarity and a place to start i would be most
grateful!...
Many thanks!
Simon
First thing I'd do is to upgrade to a supported os!
Hopefully you've got separate logfiles for the sites... work out which
site is causing problems. I'd also put up some monitoring software - cacti,
munin or similar and look for other patterns... a problem with mysql
connections can cause this... and a default mysql install is extremely
restrictive.
Cheers for the reply... yep - seperate log files, but over 300+
vhosts, so a little hard to check that way! :) We have two separate
MySQL servers (v4 and v5).

Any further ideas?

Simon

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Steve Holdoway
2010-10-07 22:02:59 UTC
Permalink
Post by Simon
Cheers for the reply... yep - seperate log files, but over 300+
vhosts, so a little hard to check that way! :) We have two separate
MySQL servers (v4 and v5).
Any further ideas?
Simon
It's simple enough to order the access logs by size...

Does the whole server hang, or is it just the webserver? With a spike
like that, you could be running short of memory/swap as well.

To get an idea of how well mysql is configured, there's a basic script
you can run to check... http://www.day32.com/MySQL/ first one.

But the real answer is to monitor your server. It's much faster than
asking us to guess (:

Steve
--
Steve Holdoway BSc(Hons) MNZCS <***@greengecko.co.nz>
http://www.greengecko.co.nz
MSN: ***@greengecko.co.nz
Skype: sholdowa
Chris Hodgetts
2010-10-07 23:51:50 UTC
Permalink
PHP memory issues???

Sun Spots?
Post by Steve Holdoway
Post by Simon
Cheers for the reply... yep - seperate log files, but over 300+
vhosts, so a little hard to check that way! :) We have two separate
MySQL servers (v4 and v5).
Any further ideas?
Simon
It's simple enough to order the access logs by size...
Does the whole server hang, or is it just the webserver? With a spike
like that, you could be running short of memory/swap as well.
To get an idea of how well mysql is configured, there's a basic script
you can run to check... http://www.day32.com/MySQL/ first one.
But the real answer is to monitor your server. It's much faster than
Steve
_______________________________________________
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Craig Box
2010-10-07 21:42:03 UTC
Permalink
Post by Simon
We have apache2/php5 running on debian etch... i think just a pretty
standard config, running multiple vhosts - both name and IP based. The
issue is is that every now and again, the apache processes spike up to
210+ ish and the server eventually stops responding. An apache restart
solves this issue... but we are solving a problem with a workaround
rather than actually looking and understanding what is going wrong.
210 processes, or 210MB of memory per process?
_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Daniel Pittman
2010-10-08 09:56:14 UTC
Permalink
Craig Box <***@dubculture.co.nz> writes:

This is sent while travelling, ironically, in NZ; it may be somewhat delayed
while finding Internet access, so please forgive me if it is no longer
relevant to the discussion.
Post by Craig Box
Post by Simon
We have apache2/php5 running on debian etch... i think just a pretty
standard config, running multiple vhosts - both name and IP based. The
issue is is that every now and again, the apache processes spike up to 210+
ish and the server eventually stops responding. An apache restart solves
this issue... but we are solving a problem with a workaround rather than
actually looking and understanding what is going wrong.
210 processes, or 210MB of memory per process?
This is a very relevant question, but my guess is going to be for 210
processes; Debian default to MaxClients 150, and it is not uncommon for people
who don't really know better to just bump that up and up.

The first thing I would advise the OP is to grab the smem tool and use that:
it will tell you a much more *interesting* bit of data about your Apache
processes than top, ps, or the more usual run of tools.

What you want to get out of that is the 'PSS' figure: the Proportional Set
Size, and the 'USS' or Unique Set Size; they are more interesting than the
RSS, because they tell you how much each instance of Apache *really* costs you
to run (on average) on the system.[1][2]


Once you have that (and the PSS of any other services the system runs) you can
identify the correct tuning for the machine — what MaxClients setting you can
afford without pushing the system out of memory.

(For many systems this is something on the order of 50 Apache processes, and
the 'worker' model *is* a little less expensive, but not very much. This is
why NGINX, LigHTTPD, and other tools are attractive. :)


OTOH, if the problem of the OP is that memory use goes too high the solution
is almost certainly equally simple: adjust the PHP memory limit to something
more reasonable, calculated again as PSS against available memory, so that
your threads can't ever run you out of memory enough to complete operation.

That, plus a bit of logging to catch PHP things terminated with OOM should
give you a reasonable way to track down the problem source.

Regards,
Daniel

Footnotes:
[1] Specifically, the PSS is the *proportional* cost of each individual
instance of the process according to the total physical memory consumed
by the set of processes on the system.

[2] If your processes have swapped data out that isn't counted, so check you
are not thrashing before you rely on these numbers.
--
✣ Daniel Pittman ✉ ***@rimspace.net ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons

_______________________________________________
NZLUG mailing list ***@linux.net.nz
http://www.linux.net.nz/cgi-bin/mailman/listinfo/nzlug
Continue reading on narkive:
Loading...