Russ Thompson on 17 Jan 2012 12:34:59 -0800


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Tuning Apache/PHP memory use...


Paul,

Which flavor of Linux are you running?

I tend to dislike swappiness @ 60 (default), I prefer it to favor memory heavily therefore set this to 0-20 depending on the application.

-Russ

On Tue, Jan 17, 2012 at 3:32 PM, Paul Walker <starsinmypockets@gmail.com> wrote:
The swappiness is set at 60.


On Tue, Jan 17, 2012 at 3:30 PM, Russ Thompson <vigornj@gmail.com> wrote:
Paul,

The value's in mySQL should be tuned based on real world results, the problem today is there are too many copy and paste my.cnf configurations floating around.  Those values should be tuned based on the output from 'show global status' you can wildcard as well such as 'show global status like '%cache%'.  I typically look at those numbers and calculate cache hit rates, then adjust accordingly.

What is your VM swappiness set to? sysctl -a | grep -i swappi

Varnish works particularly well for Caching.  I'm personally not a fan of using Apache at all for PHP, if you're using PHP nginX is the way to go.  This is a very popular trend with many PHP shops migrating to nginX.

-Russ

On Tue, Jan 17, 2012 at 3:24 PM, Paul Walker <starsinmypockets@gmail.com> wrote:
I'm running a linode VPS that's serving about 8-10 medium/low traffic Drupal sites via Apache 2.2.  I'm running into a memory bottleneck: Apache opens ~8 running processes that each swell to nearly 100MB of (virtual) memory each; stuff starts getting swapped to the swapdisk, and everything grinds to a halt. I've set the mysql and apache settings to those recommended by the linode faq: 

mysql
key_buffer = 16K
max_allowed_packet = 1M
thread_stack = 64K
table_cache = 4
sort_buffer = 64K
net_buffer_length = 2K
Apache
StartServers 1
MinSpareServers 3
MaxSpareServers 6
ServerLimit 24
MaxClients 24
MaxRequestsPerChild 3000
I'm thinking that I may need to institute some sort of caching so that Apache is serving static pages and not calling the PHP scripts on every request, but I'm not sure what strategy is here. Has anyone come up with a good strategy for limiting Apache and PHPs memory usage in a similar situation?

Any help appreciated!

Paul


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug



___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug



___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug