• I noticed wordpress is hogging 50% to 100% of my dedicated server’s CPU on a single request so I started to do some testing.

    (Watch in 1080p or you can’t see anything)
    https://www.youtube.com/watch?v=xIkSgdjRUoI

    Debian6, 2GB RAM, 2x 1.6GHz

    So I made a copy of the website and put it on a VPS with Debian5, 512MB RAM, shared 4x 2.5GHz . I disabled all wordpress plug-ins prior to this test.

    https://www.youtube.com/watch?v=6z7l1Cb_kRE

    It’s using *way* too much. 10 simultaneous connections causes 100% load on all 4 cores.

    So, it happens on both servers, so it’s obviously something wordpress related. Plugins are off so it can’t be that. So I tried installing xcache, it didn’t help ;(

    https://i1132.photobucket.com/albums/m577/kakaboeie/xcache-nohelp.png

    I use lighttpd as a webserver, btw. I read some people’s posts over the internets saying they get ~50.000 pageviews per day and don’t even come near to the resources I am using up with 10 requests.

    What can be causing this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator cubecolour

    (@numeeja)

    You’ve taken the plugins out of the equation but as a matter of interest were the tests conducted with your theme or the default theme? This may help you to pinpoint whether there’s something in the theme causing the issue.

    You may want to enable the error log to see whether you get any clues there
    https://codex.www.ads-software.com/Editing_wp-config.php#Configure_Error_Log

    Thread Starter natli

    (@natli)

    I switched the theme back to TwentyTen and tried both error logging methods, but both php_error.log and wp-content/debug.log remain empty even though they are chmodded to 777. I’m assuming that’s because no errors are found.

    The default theme vs. my own theme made no difference either. I’m currently trying to set up another copy on apache2 rather than lighttpd but I keep getting the Blank Page of Death with the following errors;

    Notice: Constant ABSPATH already defined in /var/www/xxx/wp-config.php on line 35
    Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/xxx/wp-settings.php on line 32

    So I’m currently trying to figure that out.

    Thread Starter natli

    (@natli)

    I couldn’t figure out how to get rid of the blank screen so I made a fresh install with apache2 + mysql + phpmyadmin + wordpress and nothing else. Then I imported the posts from the original wordpress install and this is the result:

    https://www.youtube.com/watch?v=97Dnjhw5k5g

    Is that load (~80% at 4 to 7 requests per second) normal? It’s an Intel i5-2500 @ 3.3GHz CPU with 1GB RAM. I imported nothing else except the ~10-or-so posts, not even categories.

    If it makes you feel any better, I have the exact same issue on shared hosting. Switched off all plug-ins, reverted to default theme and yet still the CPU is spiking and maxing out. It is extremely frustrating and at the moment I do not know what to do..

    Thread Starter natli

    (@natli)

    As it turns out, this is normal wordpress behavior..

    What I did was install WP_Super_Cache to prevent PHP from re-generating pages that haven’t been changed.

    I’m not sure how this affects plugins like StatPress, but I ended up completely bypassing PHP by using lighttpd with LUA rewriting. An LUA script now checks if a html page is already generated by WP_Super_Cache and servers that page immediately. If not, it continues as it would normally.

    I can now serve 100 pages per second With the CPU not even reaching 20%. But I don’t think this would be possible with shared hosting since you probably can’t install lighttpd with LUA support without root access. Nevertheless, using WP_Super_cache will be a big improvement on it’s own!

    I still wonder why wordpress uses so much CPU to begin with, though…

    Hmm, I’ve gone from SC to W3 and am now happily on Quick Cache. Also, as a side effect (since WordPress cannot generate the page that is needed) I get 404 messages If I try to view Jetpack Stats. I have to reload the page several times for it to finally come up. Super frustrating..

    cocoa,

    I followed your path to Quick Cache. I’ve tried Super Cache in the past and although it was great for anonymous users, it didn’t do much for logged-in users. I had a quick go with Total Cache but didn’t want to take the time to go over all the settings. Quick Cache was easy to setup; it can cache for logged-in users too but do remember to change the setting.

    Quick Cache took my CPU time down considerably.

    Thread Starter natli

    (@natli)

    Actually, I think super cache doesn’t do *anything* for logged in users. So yea if you do have allot of co-bloggers or commenters it’s probably best to use Quick Cache, although I have never used it before myself.

    I’m having the same issue with one of my sites. The CPU was jumping and crashing the site. We were getting 500 errors intermittently throughout the day.

    I changed themes, got rid of all the plugins I could, turned on debug to see which plugins might be throwing errors. Some were, so nixed them and replaced them with good plugins.

    CPU still spiked. Then my host said they thought it was from wp-cron.php running too many processes every minute. So I disabled wp-cron, and ran it manually twice a day. Got the CPU down from 13 to 2-3, but my host wants it around 1%!

    I also installed WP Super Cache, which I like a lot. My site loads way faster and works great, but this doesn’t seem to bring down the CPU more.

    This is really frustrating! Now I have a plugin called wp-cron so I can see what process WP’s plugins need from wp-cron.php from the dashboard, and I installed WP-Cron Control, which is supposed to prevent wp-cron from going nuts and running when I want it too, just twice a day.

    Still the CPU spikes. But what’s really confusing is I have my personal site with 3 instances of WP from the same host, just as much traffic, more plugins, yet that CPU is always under one percent! I don’t get it!

    Is it the host server set up? Or is WP just a memory pig? I don’t know.

    I’m having the same issue with one of my sites. The CPU was jumping and crashing the site. We were getting 500 errors intermittently throughout the day.

    I changed themes, got rid of all the plugins I could, turned on debug to see which plugins might be throwing errors. Some were, so nixed them and replaced them with good plugins.

    CPU still spiked. Then my host said they thought it was from wp-cron.php running too many processes every minute. So I disabled wp-cron, and ran it manually twice a day. Got the CPU down from 13 to 2-3, but my host wants it around 1%!

    I also installed WP Super Cache, which I like a lot. My site loads way faster and works great, but this doesn’t seem to bring down the CPU more.

    This is really frustrating! Now I have a plugin called wp-cron so I can see what process WP’s plugins need from wp-cron.php from the dashboard, and I installed WP-Cron Control, which is supposed to prevent wp-cron from going nuts and running when I want it too, just twice a day.

    Still the CPU spikes. But what’s really confusing is I have my personal site with 3 instances of WP from the same host, just as much traffic, more plugins, yet that CPU is always under one percent! I don’t get it!

    Is it the host server set up? Or is WP just a memory pig? I don’t know.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘WordPress hogging all CPU’ is closed to new replies.