Support » Fixing WordPress » Dreamhost Memory Usage on VPS

  • Hello,


    I’m currently running WordPress 3.5.1 for the last 2 months on dreamhost using VPS. When the site launched, every few days it would run out of memory and need to be rebooted via the control panel.

    I investigated the code for memory leaks and memory usage carefully and implemented caching. This made the site run for a week at a time before needing a reboot. So it helped but didn’t solve the issue.

    I cannot continue to reboot the server weekly to keep it running. Anyone have any suggestions on how to track down what’s causing this?

    Here’s some data that may help.

    Currently allocated memory: 600 MB
    WordPress version: 3.5.1
    Plugins: Askimet – Advanced Custom Fields – Hierarchical Link Categories – WordPress Importer – WP Memory Usage – WP Super Cache

    Analytics From Jan 1 2013 – Feb 20 2013
    99,130 Visits
    52,836 Unique Visitors
    212,135 Page Views

    Thanks in advance for anyone with insight to be provided.

Viewing 15 replies - 1 through 15 (of 19 total)
  • I honestly wouldn’t want to run a site that gets ~60k visits a month on less than 2g on memory.

    As an example, I manage a site that’s about double that traffic wise and we have four and we still nearly peg it sometimes.

    I was just checking the error logs and found this repeatedly. Maybe this is related?

    [Wed Feb 20 01:59:56 2013] [error] [client] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace.

    That would do it. It could be a lot of things though. It could be an .htaccess redirect, could be an apache redirect, could be some application level redirects, etc.

    I have to second Andrew there. 600megs is cutting it close. You’ve got 212 pageviews in a month an a half (so we’ll say 180k a month?) That’s a lot. I’d be running at least a gig on it, since your load is nice and low. If load started spiking with a lot of posts, you’d want to bump that to 2.

    By the way, WP Super Cache doesn’t seem to be working. It’s not showing up in your page source, so that certainly isn’t helping.

    I’d normally say to use W3 Total Cache on a VPS, but since Memory’s already an issue, and W3TC uses more, you should try customizing with Pagespeed first. You can turn it on in your panel.

    Yup, Super Cache was off as I was doing some testing. It’s back on now.

    I agree the RAM should probably be increased but I’m also working for a customer with a set budget.

    We tried this at first – Memory was bumped up to 4GB and I watched memory usage climb slowly over 2 weeks to or so to using 4GB and then requiring a reboot. That’s what lead me to suspect memory leak.

    For the most part, with Super Cache on it’s happening less but it’s still requiring too frequent of reboots.

    I’m currently trying to get the apache error to trigger. But even when combining the access.log details with the error.log I can’t find a URL to hit that will trigger the apache error. There is also no referrer for the apache error. If I could find a URL to trigger the error, I could adjust the .htaccess accordingly and see if anything in there is causing it.

    There are a couple small things you can do to save memory on the VPS.

    Turn off Jabber and FTP. You’ll have to use SFTP instead, but that’s safer anyway.

    You can also switch to PHP 5.3 FastCGI (you’re just on CGI now), which uses less memory in our config, and turn on PageSpeed, which will let you compress CSS and JS, without making WP do the work. PageSpeed won’t help memory much, but it will keep the site running faster.

    Also you can remove the ‘Remove the www’ bit from your .htaccess and have that forced in Panel as well.

    I noticed you have WP in a subfolder, but INSTEAD of running it out of it’s own directory via index.php, you’re using a more complicated .htaccess rule, which may be what’s going on. Is there a reason you didn’t want to use the normal way about that?

    I switched over to PHP 5.3 FastCGI, turned on PageSpeed and removed my .htaccess rule for WWW removal (and set it up via the dreamhost panel). I set Jabber & ftp to inactive on the configure server page.

    I prefer to run wordpress in a subfolder with the core and content folders clearly separated so it’s easier to update and more importantly gives me the ability to keep core in an external so I can drop in a boilerplate of sorts into content with a nice skeleton theme to start from. I haven’t had issues with this on other wordpress sites I’ve done, even ones currently residing on dreamhost.

    I did however look closely at my htaccess rules and found a duplicate rule. One in the site root and one in the subfolder .htaccess. The one in core had been added by something in wordpress to handle permalinks. Now that I’ve removed one of the duplicate rules, the LimitInternalRecursion error hasn’t showed up in my log in the last 12 hours (was previously happy much more frequently).

    I’ve made a lot of changes so I’m going to monitor for a few days and see what comes of it. Thanks for your help!

    I prefer to run wordpress in a subfolder with the core and content folders clearly separated so it’s easier to update and more importantly gives me the ability to keep core in an external so I can drop in a boilerplate of sorts into content with a nice skeleton theme to start from.

    Sure but the way you’re doing it is… odd 🙂

    That’s what made me go ‘Huh?’ I almost always have WP in it’s own folder too, cause I’m a neat freak 😉 but also because I’m usually running more than ‘just’ WordPress, so I have /wordpress /mediawiki and /zenphoto all in a row.

    Here’s an update on memory usage ->

    You can see where I switched to FastCGI… The memory usage appears much more volatile and up and down. Prior to that it would slowly ramp up over time but the graph is more all over the place now this morning.

    I can’t remember where but I previously read about not using FastiCGI due to this. Perhaps I’m incorrect. When I read this I stopped using FastCGI and things level out.

    Interesting… I’ve not seen that happen before, but every site is different. I agree, I’d switch back to 5.3.x CGI (or 5.2 if you want to turn on xcache without installing it manually).

    I switched it back to regular CGI and not FastCGI. Things appear to be stabilizing again. I’ll need at least a few hours to get some accurate data.

    I wonder if it’s something else you’re running. I’ll poke around and see what’s up with that on another server 🙂

    Thanks for taking a look!

    Did you find anything out? I’ve been watching the last couple of days. It seems that usually around 4a-5a a bunch of cached memory clears out. What causes that? Is there anyway to make that happen more frequently?

    I haven’t had a chance to dig into it as much as I want (Friday ran away with me, and I was prepping for a WordPress presentation this coming weekend).

    The cache being flushed at night is what we want. There isn’t a way to hook into that though without rebooting, which we rarely want. is a script one of our users wrote to manage a VPS, but it too has to reboot you :/

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Dreamhost Memory Usage on VPS’ is closed to new replies.