Brian Wigginton Lab and Nerdery

LAMP Stack Optimizations for Small Servers

Posted on January 21, 2011

This WordPress blog is running on a 256MB Slicehost VPS. Here are the settings I have in place to keep Apache and MySQL responsive. Without these settings, the server would often come to a grinding hault and SSH interactions would become very slow and sometimes hang.

Apache - httpd.conf - mpm_prefork_module Settings

<IfModule mpm_prefork_module>
    StartServers          2
    MinSpareServers       2
    MaxSpareServers       4
    MaxClients            50
    MaxRequestsPerChild   500
</IfModule>

I found that I saved a bunch of memory just by using less apache processes. Instead of spawing 8 processes by default I'm only going to spawn one and limit the max spares to 4, which means after some load I should only have 4 processes lingering around waiting to serve pages.

MySQL - my.cnf settings

skip-innodb
skip-bdb
skip-ndbcluster

I dropped mysql's memory useage by about 11M (sitting right under 5M right now) just by disabling innodb support. I've also done some very heavy WordPress caching using wp-supercache. this basically caches every page and post so that I'm just serving up static html content instead of processing the entire WordPress stack for every page load.

Filed under: Apache, MySQL Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

 

No trackbacks yet.

Google+