Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache MPM configuration advice for low memory server
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
bLaXe
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2004
Posts: 81
Location: Berkshire, UK

PostPosted: Fri Apr 13, 2007 3:53 pm    Post subject: Apache MPM configuration advice for low memory server Reply with quote

Hi guys, I'm looking for a bit guidance here...

I'm running Apache2 on a small UML server, hosted at Bytemark. See here for details. My machine has 160MB memory and an 8GB disc.

Recently a site hosted on this machine hit the digg front page, and it couldn't cope. I hadn't done any performance tuning to server before (the digg was unexpected). Since then I've made lots of improvements to the configuration of Apache/MySQL/Wordpress/etc, and the server is now able to take "ab2 -n 10000 -c 200" without falling over, but I'm still unsure how to go about configuring the Apache MPM settings.

Here's what I have right now in httpd.conf, using the 'prefork' method:
Code:

<IfModule prefork.c>
    StartServers         2
    MinSpareServers      2
    MaxSpareServers     5
    MaxClients          50
    MaxRequestsPerChild  1000
</IfModule>


Since the traffic on the server is generally pretty light I've set StartServers and Min/MaxSpareServers pretty low, that's right isn't it?

I'm not so sure about the MaxClients setting - with only 160MB of memory total I'm worried it will eat up all the memory if there 50 processes running at once.

Basically, I'm a bit unsure of what I'm doing. Does anyone have any thoughts a sensible MaxClients setting when memory is so limited?
Back to top
View user's profile Send private message
kashani
Advocate
Advocate


Joined: 02 Sep 2002
Posts: 2032
Location: San Francisco

PostPosted: Fri Apr 13, 2007 6:43 pm    Post subject: Reply with quote

The best thing you can do in this case is install the Cache plugin for Wordpress. This will build static pages of all your Wordpress pages after they are rendered the first time. This has the benefit of being able to serve content out of memory and avoiding PHP parsing/execution 99% of the time.

In regards to memory, prefork has the lowest initial memory. I'd figure out ho much memory you want Apache to max at, maybe 100MB, and then divide that by the size of each Apache process on your system.

kashani
_________________
Will personally fix your server in exchange for motorcycle related shop tools in good shape.
Back to top
View user's profile Send private message
bLaXe
Tux's lil' helper
Tux's lil' helper


Joined: 14 Nov 2004
Posts: 81
Location: Berkshire, UK

PostPosted: Sun Apr 15, 2007 12:15 am    Post subject: Reply with quote

kashani wrote:
The best thing you can do in this case is install the Cache plugin for Wordpress. This will build static pages of all your Wordpress pages after they are rendered the first time. This has the benefit of being able to serve content out of memory and avoiding PHP parsing/execution 99% of the time.

I already have WP-Cache running on the sites - I also upgraded Wordpress from 2.0 to 2.1, as there was some work done on internal caching etc in 2.1.

kashani wrote:
In regards to memory, prefork has the lowest initial memory. I'd figure out ho much memory you want Apache to max at, maybe 100MB, and then divide that by the size of each Apache process on your system.

Thanks for the advice. I'll stick with prefork.

I've been tweaking the settings most of the evening. It happened that the same article that got 'digged' made the slashdot front page today - so I've been able to monitor the server while it's under high load (how handy...).

After much fiddling, I've settled on this:
Code:
StartServers 5
MinSpareServers 10
MaxSpareServers 20
MaxClients 45
MaxRequestsPerChild  5000

With these settings the server is handling the slashdotting quite nicely - the server is still pretty responsive, especially for cached WP pages. It's been using around 100MB of memory, with system load hovering between 0.7 and 1.5. I'm happy with that :) Webstats here.

I might tighten up the memory usage more (lower MaxClients), as I'm planning to run Tomcat on the same server and that will no doubt require a fair chunk of memory.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum