I have a server running 3 WordPress instances, MySql, Apache and the play framework 2.0 on 64m initial & max heap. If I increase the max heap of the JVM that play is running in even by 16m I see the 128m of swap space steadily fill up until the the JVM dies.
I notice that it is only when I am plugging away at the wordpress sites that the JVM will die. I assume this is because the JVM is not asking for memory at the time so gets collected.
I notice that when I restart Apache I reclaim about half of my swap and RAM. So is there some way I can configure apache to consume less memory? Also what could be causing the swap space to get so heavily thrashed with just 16m added to the max heap size of the JVM?
Server running: Ubuntu 12.04
RAM: 408m
Swap: 128m
Apache mods:
- alias.conf
- alias.load
- auth_basic.load
- authn_file.load
- authz_default.load
- authz_groupfile.load
- authz_host.load
- authz_user.load
- autoindex.conf
- autoindex.load
- cgi.load
- deflate.conf
- deflate.load
- dir.conf
- dir.load
- env.load
- mime.conf
- mime.load
- negotiation.conf
- negotiation.load
- php5.conf
- php5.load
- proxy_ajp.load
- proxy_balancer.conf
- proxy_balancer.load
- proxy.conf
- proxy_connect.load
- proxy_ftp.conf
- proxy_ftp.load
- proxy_http.load
- proxy.load
- reqtimeout.conf
- reqtimeout.load
- rewrite.load
- setenvif.conf
- setenvif.load
- status.conf
- status.load
128m is definitely in the absolute lowest range of what you need for running 3 WordPress sites, MySQL and a java application.
To lower your web servers memory footprint, I would suggest that you switch from Apache to nginx + php5-fpm. Both are available through the Ubuntu repositories.