Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Aug 23, 2012 9:34 am 
Offline
Senior Newbie

Joined: Thu Aug 23, 2012 9:26 am
Posts: 6
I have a Linode that has Ubuntu loaded and am hosting a WordPress site. I would like to optimize my site so that I no longer get Out of Memory errors like the following:

Killed process 16660 (apache2) total-vm:186232kB, anon-rss:87404kB, file-rss:0kB

I have 512 MB of ram and whenever I get a spike of 500+ users trying to access the site, the site becomes unresponsive and I start getting the errors above.

Please let me know of any optimizations that I can make to help improve site performance.

Thanks in advance


Top
   
PostPosted: Thu Aug 23, 2012 9:41 am 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
Edit the prefork section of the config and change MaxClients to 15 or 20, and then disable KeepAlives, restart apache. Start there.

-Chris


Top
   
PostPosted: Thu Aug 23, 2012 9:58 am 
Offline
Senior Newbie

Joined: Thu Aug 23, 2012 9:26 am
Posts: 6
Thanks for those.

Any other optimation settings I should know of?


Top
   
PostPosted: Thu Aug 23, 2012 10:09 am 
Offline
Senior Newbie

Joined: Thu Aug 23, 2012 9:26 am
Posts: 6
What are the optimum settings for the mpm prefork module?

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 20
ServerLimit 75
MaxClients 75
MaxRequestsPerChild 1000
</IfModule>


Top
   
PostPosted: Thu Aug 23, 2012 10:20 am 
Offline
Senior Newbie

Joined: Thu Aug 23, 2012 9:26 am
Posts: 6
Ok. I have applied the MaxClients of 20 and I am still getting the Out of Memory errors


Top
   
PostPosted: Thu Aug 23, 2012 10:22 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Make it less then, if you have 8 PHP processes using 64MB of RAM then you're using your full 512MB, this isn't unusual with wordpress, keep lowering your MaxClients until the memory errors stop.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Last edited by obs on Thu Aug 23, 2012 2:14 pm, edited 1 time in total.

Top
   
PostPosted: Thu Aug 23, 2012 11:38 am 
Offline
Senior Newbie

Joined: Thu Aug 23, 2012 9:26 am
Posts: 6
Where does the number 8 come from?


Top
   
PostPosted: Thu Aug 23, 2012 2:14 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Just a random number, 8 PHP processes = 8 concurrent PHP pages being served.

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
PostPosted: Thu Aug 23, 2012 3:27 pm 
Offline
Senior Newbie

Joined: Thu Aug 23, 2012 9:26 am
Posts: 6
Gotcha! I didn't know if that number came from the prefork settings or not. Please forgive me, I am new to Apache...


Top
   
PostPosted: Wed Aug 29, 2012 12:14 pm 
Offline
Newbie

Joined: Wed Aug 29, 2012 11:35 am
Posts: 3
If you have many php pages. use this setting:
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 75
MaxClients 75
MaxRequestsPerChild 1000
</IfModule>

if your system used swap more then 300MB always, change MaxRequestsPerChild to 500.


Top
   
PostPosted: Wed Aug 29, 2012 12:44 pm 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
MaxClients of 75 is a recipe for OOM. Reducing MaxRequestsPerChild only means a process will exit sooner, but Apache will still launch more processes than can fit into memory. If each Apache process is using 12M of RAM that's 900 MB on a 512 system.

Start by changing MaxClients to 10 or 20, disable KeepAlives, and move on from there.

-Chris


Top
   
PostPosted: Mon Oct 08, 2012 10:45 pm 
Offline
Senior Newbie

Joined: Wed Dec 30, 2009 11:18 pm
Posts: 16
You should consider nginx w/ http://wordpress.org/extend/plugins/nginx-helper/

Remove w3-cache and just use the nginx helper following http://rtcamp.com/tutorials/wordpress-n ... nditional/

You may find it will considerably increase your concurrent users as it will skip php completely and serve a static html file bypassing php-fpm, except for logged in users and posting comments.


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


Who is online

Users browsing this forum: No registered users and 2 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