WordPress.org

Support

Support » How-To and Troubleshooting » Very High CPU Usage

Very High CPU Usage

  • Hello,

    Long time reader, first time poster.

    I have a problem with my WordPress installation. I even got banned from shared hosting for this and put my own server and still have this problem. Apache has a very high CPU usage (it makes 100% of 1-3 processes) on a 1.5GHz box every time I get a dynamic request on the server.

    My DB is 30MB and have about 4000 pages (articles + pages) on the website.

    Without cache the site works really bad (I use wp-super-cache).

    I tried updating WordPress (I’m on 2.3.3. now. 2.5 blocks my server completely with a single process using 100% CPU and the older version (2.0.x, etc) work in a similar bad way), disabling all the plugins, enabling cache but didn’t find a way to get decent CPU usage from Apache (MySQL works OK. Apache is the problem).

    I use now an Ubuntu Server with LAMP chosen at install. The old hosting (which banned me for exceeding CPU quota) was GoDaddy. Also I should mention that accessing the permalinks page (in options) takes 30-100 seconds, time in which the CPU stays at 100%.

    Thanks.

Viewing 15 replies - 1 through 15 (of 71 total)
  • Nobody else with high CPU load?

    Not here, and I run a WordPress site that gets around 25,000 page views a day. Although I have a better CPU than you – CPU is a Core 2 Duo 2.20GHz, it shouldn’t be that big of a difference.

    I would move to Lighttpd and install XCache. That’s what I’m running currently.

    I get around 5.000 on a box with 1.5GHz and every single WordPress dynamic access has an impact on the usage. For example it never serves dynamic pages faster than 5 seconds, with a medium value of 10 seconds. If I access the permalinks page the server is stuck for about 100 seconds.

    From what I read on the Internet lighttpd is more for static contect. It doesn’t run PHP that fine. Also having LAMP (like most of people using WordPress have) is easier due to similar problems/solutions.

    I wouldn’t recommend using lighttpd. One of my servers is only a dual 866MHz PIII 2GB RAM and has, among others, a WordPress site with 5000+ categories and a lot of pages. Everything was slow on the site. Many admin functions timed out and wouldn’t work.
    The reason it’s so slow is because WordPress is very inefficient in going through the various database tables to get the information it wants. It loads everything into memory over and over and processes a lot more than it needs to.
    My solution was to rewrite a lot of the WordPress functionality to be more efficient and use fewer SQL queries.
    Do you own the Ubuntu server or is it shared hosting?

    I own my Ubuntu server. I put it online because shared hosting providers are not really happy with the CPU load I produce.

    I have to 5000+ categories and about 5000 post + pages. The pages list and options-permalinks pages take a huge time to load, with 100% load on the CPU.

    I consider exporting the info from the DB and creating a new DB because I consider possible that the DB created on an older version and with many info in it (30MB has the DB on 2.3.3) maybe not to optimized. Just a thought.

    Unfortunately I’m not really skilled in rewriting PHP to MySQL queries. It would be great if you were able to do so to upload them to the WordPress code tree or even post them here with explanations so people can use them if they have a case similar to yours.

    What is the link to your website?

    http://www.thecelebrityblog.com/

    Now I’m moving it back to shared hosting due to some optimizations made.

    I managed to get suspended in under 5 minutes. I put my DB back online on the shared hosting and by setting my permalinks from options (which makes a huge load on CPU) I got suspended again. Moving right now the DNS back to my personal dedicated server.

    Waiting for any advice.

    Nobody else has a large delay (due to CPU usage) on accessing permalinks or pages in the options menu?

    Moderator Samuel Wood (Otto)

    @otto42

    WordPress.org Tech Dude

    No, not really. The Settings->Permalinks page opens nearly instantly for me.

    Manage->Pages shouldn’t be slow because it’s not pulling all your pages, just the latest 20 or so.

    Have you considered that their might be some scripts that have been injected into your code maliciously?

    Perhaps trying to do a completely new install from fresh files would help.

    Options -> Permalinks should instantly load.
    It makes sense that Manage -> Pages doesn’t instantly load if you have 5000+ pages. WordPress cycles through each numerous types before it displays them.

    Installing fresh would be a great thing to do.
    Otherwise, you’ll need someone to look more closely at your site or write code that makes fewer and direct sql queries and fewer processing like I had to do with one of my sites.

    If deleting everything instead of wp-content when you update is considered a fresh install then yes, I do fresh installs pretty often.

    When you say fresh install do you mean new template/DB or just changing everything else?

    Also just noticed that if a crawler passes by my server and asks for every single possible page an category the server is trashed by CPU usage and unable so serve anything else. Every single dynamic request result in a Apache process that uses tons of CPU (and a mysql one with less). During that time no cache page is served due to the CPU usage (and maybe limited number of servers available due to limited RAM).

    Generally a fresh install just means overwriting everything except wp-content, however, this could be extended to mean a start from scratch install, and importing your data (which I don’t recommend unless you’re good with mysql).
    It’s very common for apache to temporarily use a large amount of the CPU while doing certain things (for instance executing PHP). That’s normal. If you’re unable to serve static pages at the same time, I’d take a look at the memory usage of apache and of mysql per instance.
    What are you using for caching?

Viewing 15 replies - 1 through 15 (of 71 total)
  • The topic ‘Very High CPU Usage’ is closed to new replies.
Skip to toolbar