Slow Apache

0 views
Skip to first unread message

Penz

unread,
Apr 17, 2008, 2:45:21 PM4/17/08
to DeRailed - Denver Rails UG
My friend's VPS running Apache is performing like a dog, even with 75
Apache processes. We are getting "out of virtual memory" errors and
crashes. We don't know why, and the site host is offering double the
"processes" for double the $$$. The site is under 100K page views a
month, and 100 podcast downloads a day.

Can some who is knowledgeable about Apache take a look at this? He
will pay for your time. We just need an experienced set of eyes.

ASAP please.

Thanks,
Ward
720.422.3239
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Peter Jones

unread,
Apr 18, 2008, 11:05:03 AM4/18/08
to dera...@googlegroups.com
Penz <wp2...@gmail.com> writes:
> My friend's VPS running Apache is performing like a dog, even with 75
> Apache processes. We are getting "out of virtual memory" errors and
> crashes. We don't know why, and the site host is offering double the
> "processes" for double the $$$. The site is under 100K page views a
> month, and 100 podcast downloads a day.

I don't have the time to be overly helpful, but I thought I'd chime in
with some pointers.

First off, 75 Apache processes? That seems pretty excessive. I've
worked with some high volume installations of Apache that weren't
using that many child processes.

The virtual memory errors you are having could be caused by that
number alone. But I'm also wondering about how many Ruby processes
you are running as well.

Since you are optimizing for memory usage, I would start by scaling
way back. Maybe drop your max Apache children setting to 15, and your
minimum to 8. I'd also run about 5 or 6 mongrel processes.

You should also be using a tool like monit[1], specifically for its
ability to restart processes that are using too much memory. I'd set
a strict cap for those mongrel processes, once they exceed your memory
usage threshold, restart them.

Now, none of the above is considering the podcasts you are serving.
If they are big, I can see them using Apache processes during the file
transfers. I'd make sure that only Apache is involved with the
podcast download, and that Rails wasn't being invoked whatsoever.

You could further optimize by moving the podcasts to another host,
like a cheap Dreamhost account.

Hope this was helpful.


Footnotes:
[1] http://tildeslash.com/monit/

--
Peter Jones, pmade inc.
http://pmade.com

Ben Schumacher

unread,
Apr 18, 2008, 12:06:41 PM4/18/08
to dera...@googlegroups.com, Penz

Ward-

I'd guess that adding more Apache processes isn't go to be the
solution. In all likely hood your VPS is getting backed up by latency
and spinning off more Apache processes which is compounding the issue.
Given that 100K page views isn't really that high (you're looking at a
little over two page views a minute -- what's your total
requests/month?), I would guess that you might need to optimize your
application and/or add more caching if possible. It could also be
latency in the database... maybe bad indexes or queries?

I'd be happy to work on helping to diagnose the issue for you, but I
would be able to until this weekend (time constraints from my day
job). Please feel free to contact me if this is issue is still
unresolved.

Good luck,
Ben
bensch...@gmail.com

Tom Anderson

unread,
Apr 19, 2008, 2:05:27 AM4/19/08
to dera...@googlegroups.com
I remember tuning apache for some heavily loaded sites and it seems to me that the KeepAliveTimeout setting had the most impact.   I think the apache default was way too high, something like 15 seconds... reduce that to 2 seconds or so to let apache release connections faster.   Of course, there are lots of other settings you can play with but that's the one that I remember helping quite a bit.

On Thu, Apr 17, 2008 at 12:45 PM, Penz <wp2...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages