Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Oct 19, 2011 10:44 pm 
Offline
Senior Newbie

Joined: Wed Nov 17, 2010 5:57 pm
Posts: 8
I'm relatively inexperienced with the specific settings for servers and I'm reading all I can, so please be patient.

We have a Linode512 with Debian 6.0 and using Apache2 to run a Wordpress front side of a site and a phpBB3 forums area. The site is www.feelslike98.com and about 88% of pageviews are in the forums.

The server is slowing down a lot at times. Using the Linode graphs I figured out it's IO spikes, mostly caused by memory going into swap.

I started watching the server with htop and did some research and realized it might be the MaxClients setting for MPM prefork that's letting memory run out. I backed the default number down from 150 to 30, but that seemed to make things worse. I currently have it at 80 and things are ok, but it still goes into swap.

It seems each process for apache is using about 16.8MB and the listed available memory is 497.

/usr/sbin/mysqld also consistently is using 10 processes each with 2.7% of available memory.


Just from reading, some things I'm considering looking at are lightpd and FastCGI.

Any opinions on what settings to change or things to install to help? Any input appreciated.


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 12:22 am 
Offline
Senior Member

Joined: Fri Jan 09, 2009 5:32 pm
Posts: 634
Do you have apc installed? that will help a lot with phpbb


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 12:59 am 
Offline
Senior Member

Joined: Tue May 03, 2011 11:55 am
Posts: 105
APC might only use more memory since it's an opcode cache....
I have had good success running phpbb on lighttpd so that is definitely an option. Apache is generally a resource hog when it comes to RAM and switching webservers might help you out.


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 8:49 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Try "MaxClients" of about 20 or so, and be sure to disable Keepalives (or set the timeout to ~1 second)... that should get it to stop killing itself. Running PHP within Apache requires mpm-prefork, and Apache's default settings aren't great for mpm-prefork on systems with a finite amount of RAM.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 8:55 am 
Offline
Senior Member

Joined: Fri Jan 09, 2009 5:32 pm
Posts: 634
Ghan_04 wrote:
APC might only use more memory since it's an opcode cache....
I have had good success running phpbb on lighttpd so that is definitely an option. Apache is generally a resource hog when it comes to RAM and switching webservers might help you out.


Yes, APC takes up some memory, but because it's a cache, it means you can keep a number of requests from hitting the database. In turn, you lower the maxclients because most users will be served quickly.


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 10:37 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
glg wrote:
Yes, APC takes up some memory, but because it's a cache, it means you can keep a number of requests from hitting the database.

APC doesn't help reduce database queries. It's not that kind of cache. Unless you use the variable cache functions, which very few people seem to do.

APC prevents the PHP runtime from compiling the same scripts over and over again. Half of PHP script execution time is spent compiling, so skipping this step can easily make your scripts twice as fast.


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 10:45 am 
Offline
Senior Member
User avatar

Joined: Wed Apr 20, 2011 1:09 pm
Posts: 63
hybinet wrote:
glg wrote:
Yes, APC takes up some memory, but because it's a cache, it means you can keep a number of requests from hitting the database.

APC doesn't help reduce database queries. It's not that kind of cache. Unless you use the variable cache functions, which very few people seem to do.

APC prevents the PHP runtime from compiling the same scripts over and over again. Half of PHP script execution time is spent compiling, so skipping this step can easily make your scripts twice as fast.


FWIW, phpBB3 actually can use APC as a SQL result cache (as opposed to using its native filecache). Take a look:
https://github.com/phpbb/phpbb3/blob/ma ... cm_apc.php

Also worth noting is that if you're on a prosilver style with phpBB, you're calling style.php every pageload, which is pretty taxing with performance. Use a subsilver-based style, or hack phpBB itself to use a static version of the stylesheet - it WILL net you some performance, it drops the amount of processing per user pageload drastically.


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 1:09 pm 
Offline
Senior Member

Joined: Mon Dec 07, 2009 6:46 am
Posts: 331
SMF forum also uses APC (or xcache, memcached, ...) for the same purpose.

But yes, on its own, APC only does opcode caching.


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 8:13 pm 
Offline
Senior Newbie

Joined: Wed Nov 17, 2010 5:57 pm
Posts: 8
Thanks a lot. I lowered MaxClients a lot, Set KeepAlive to 2 seconds, and installed php-cgi. It's staying out of swap much better now.

I want to let it run a bit to get a baseline, but will likely install APC.

I wonder if I need to optimize MySQL, though. There's 10 processes running (/usr/sbin/mysqld) and they seem to have grown a bit in size, now taking 5.1% of memory each. That's half my memory, although I know that's not a real number, as free memory is often greater than half. Any recommendations there?


Top
   
 Post subject:
PostPosted: Thu Oct 20, 2011 9:01 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Obsidian wrote:
FWIW, phpBB3 actually can use APC as a SQL result cache (as opposed to using its native filecache).

Thanks for correcting me there. Is this automatically activated when APC is installed, or does the admin need to change a setting?

volantis wrote:
I wonder if I need to optimize MySQL, though.

For basic tuning, nothing beats this script: http://mysqltuner.pl


Top
   
 Post subject:
PostPosted: Sun Jan 01, 2012 12:55 pm 
Offline
Senior Member
User avatar

Joined: Wed Apr 20, 2011 1:09 pm
Posts: 63
hybinet wrote:
Obsidian wrote:
FWIW, phpBB3 actually can use APC as a SQL result cache (as opposed to using its native filecache).

Thanks for correcting me there. Is this automatically activated when APC is installed, or does the admin need to change a setting?

volantis wrote:
I wonder if I need to optimize MySQL, though.

For basic tuning, nothing beats this script: http://mysqltuner.pl

Apologies for the late reply - you need to change the acm setting (should be something that mentions ACM anyways) in the config.php file to get it to use APC for the cache module.

_________________
うるさいうるさいうるさい!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 7 guests


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

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group