Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Sep 05, 2011 10:13 pm 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
I'm currently attempting to tune a WordPress site that received roughly 1mil+ pageviews a month.

The MySQL is hosted on a separate dedicated server.

Currently, the linode is running out of memory with default apache settings. Looking for any insight from the more experienced admin's out here on Max servers, childs, etc I should be tweaking.

Thanks in advance.


Top
   
 Post subject:
PostPosted: Mon Sep 05, 2011 10:25 pm 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
Here you can see my graphs before the system seized up for running out of memory.

https://skitch.com/mattmm/fsi1f/linode- ... node124975


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 12:27 am 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
I enabled keepalive timeout to 2 (currently not enabled at all)

Also dropped Max Requests Per Child to 5000 (down from 10000)

I don't want to speak too soon, but it's already looking better.


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 12:27 am 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
Also disabled domain logging in apache for what it was worth.


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 8:12 am 
Offline
Newbie

Joined: Mon Sep 05, 2011 8:00 am
Posts: 2
Website: http://linuxaria.com
Some considerations on the setup

Usually if you enable keepalive you use more Ram and lesser CPU.
If you turn it on I'd suggest to have:

MaxKeepAliveRequests 50
KeepAliveTimeout something between 1 and 5 (the default it's 15)

MaxClients put something that don't make crach the VPS, for this you should also check how much memory are you giving to php in the file php.ini.

So for example if you have set 100 MB in php.ini in the worst case 10 http process could eat 1 GB of Ram...

Reference:

http://virtualthreads.blogspot.com/2006 ... art-1.html


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 8:18 am 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
linuxaria thanks for the response.

What's the best way to count HTTP processes? ps aux | grep http ?


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 8:31 am 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
Found this: http://www.commandlinefu.com/commands/v ... -processes

pidof httpd | wc -w

Which returns 62 processes

Currently php.ini is set to 64mb of RAM - so that right there would eat up all my RAM.

I'm going to move to 32MB in php.ini


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 8:34 am 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
Also decided to disable keep alive after reading more about it. Thanks again.


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 9:48 am 
Offline
Senior Member

Joined: Sat Sep 25, 2010 2:25 am
Posts: 75
Website: http://www.ruchirablog.com
Location: Sri Lanka
dude you are using 225GB traffic a day thats about 6.75TB a month! Are you aware of linode bandwidth limitations and costs?

And on which data center that you are hosting mysql setup? If you arent running memcached or some sort of caching system you will be adding much latency to page loads because of mysql setup is being hosted on dedicated server which linode doesnt provide!


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 10:50 am 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
ruchirablog wrote:
dude you are using 225GB traffic a day thats about 6.75TB a month! Are you aware of linode bandwidth limitations and costs?

And on which data center that you are hosting mysql setup? If you arent running memcached or some sort of caching system you will be adding much latency to page loads because of mysql setup is being hosted on dedicated server which linode doesnt provide!


It's mostly incoming too, which is the opposite of what you'd expect (unless the graphs are misconfigured)... Assuming the graphs are misconfigured, since incoming is free, that's still 192GB per day, or ~5.8 TB per month, at an expected bandwidth overage cost of $416 per month.

Normally, I'd recommend upgrading to the next level linode to get the bandwidth rather than paying overage, since it's effectively free, but in this case the OP is on a 4096, and that's the largest linode that features linearly scaling bandwidth; the price of bandwidth included with a linode skyrockets after that (4096 is $0.10/GB, 8192 is $0.16/GB, 12288 is $0.24/GB, and so on, to the 20480 which is $0.40/GB. So there's not really any cheaper option here. I'm also not sure that even 5-6 TB/mt is enough to negotiate a bulk bandwidth discount with Linode, although it might still be worth looking into.


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 12:51 pm 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
Thanks for all the feedback.

Yes, bandwidth estimates from the clients old host were grossly under reported.

I'm actively looking to get off linode for this particular setup.


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 1:32 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
I'd caution that most places that offer bandwidth cheaper aren't going to offer you a similar quality of service. You should consider talking to Linode about reducing your bandwidth costs, they may be willing to cut a deal for bulk purchasing.

There are also other options, perhaps using CloudFlare might reduce the load, although if the bandwidth is coming from something like videos it might not help.


Top
   
 Post subject:
PostPosted: Tue Sep 06, 2011 1:37 pm 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
I agree about the quality of hosting form Linode. I was going to try cloudflare, but most of the traffic comes from images too. Not sure how much of an impact it would have.

I still use Linode for a lot of my other clients and my other services.


Top
   
 Post subject:
PostPosted: Thu Sep 08, 2011 5:01 pm 
Offline
Junior Member

Joined: Sun Mar 21, 2010 11:19 pm
Posts: 45
I think the graphs have settled as it now reports 150GB out or 9% of my months total.

Since making some tweaks we're experiencing a lot less crashing. Maybe once a day if we're lucky.

We'll see where this goes.


Top
   
 Post subject:
PostPosted: Thu Sep 08, 2011 5:22 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Your crashing is strictly coming from having maxclients set too high. Your grep showed 62 httpd processes, which means your maxclients is at least 62. The typical suggestion around her is 15 to 25, although with a 4096, 25 is probably a good starting point.

Remember that maxclients is the maximum number of *simultaneous* connections that Apache is allowed to handle. But you've only got four processor cores, there's a point of diminishing returns to trying to handle too many requests at the same time.

So, drop the maxclients value until you're not using up all your RAM (and remember that you don't want to max out the RAM, you want to leave a healthy chunk unused so that it's available for disk caching), and your OOM crashes will stop entirely.

In terms of CloudFlare (and disclaimer here, I've never used it because my volume isn't high enough to justify it), they only cache static content (images, js, css), and since images are what you're worried about, it seems ideal. I believe the free version caches them, but if not, $20/mth for pro is a lot cheaper than the hundreds in bandwidth costs at linode.

Another thing you can do is, if you're not doing it already, enable http compression. This typically has a small CPU hit and produces decent bandwidth savings (since all of your HTML/js/css/etc files are suddenly 80% smaller). It's very easy to do, just enable mod_deflate.

EDIT: CloudFlare actually did a blog post specifically on optimising wordpress:

http://blog.cloudflare.com/cloudflare-t ... rdpress-bl

One of their suggestions is to run your images through smush.it, which is a Yahoo product that essentially just runs your images through a bunch of lossless image optimization tools like pngcrush and jpegtran, and spits out the result. It can often make a decent difference on JPEGs, primarily by stripping out extra stuff a website doesn't need (all the metadata, thumbnails, etc), although it can also recompress the non-lossy parts of the JPEG compression process to help a bit too.

I like smush.it because I can just throw a bunch of images at it, which is faster than running them through various tools on the commandline myself :P


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


Who is online

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