• I have a heavy word press site that seems to cause CPU spikes on its linux host. Would installing something like W3 Total Cache help stop these CPU usage spikes? I installed the plugin P3 Plugin Performance Profiler and it says the size makes 106 MySQL Queries per page view. Thats alot isn’t it? Plugin Impact is 57.1% of page load time.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I don’t think so. The server still has to do all the work but once the server sends it’s response some things will not be downloaded by the browser because the browser has it in it’s cache memory already.

    So, caching doesn’t cause less queries.

    Not completely sure though. There is such a thing a database caching also. But I don’t know what that does.

    CPU spikes are usually caused by overactive plugins. So, I’d look there.

    The caching plugins will help, but it’s only a band-aid solution.

    Caching plugins do help server load by creating static HTML instead of allowing WordPress to serve the dynamic page content – this removes pretty much all of the processing and (more mportantly) the database and file system calls that are normally required.

    If you have a plugin that’s making over 100 MySQL queries for every page, you’re killing your server. Unless there’s an extrmely good reason for it, there’s no reason a single plugin should ever need that many DB queries.

    I was recently told my spikes are caused by slow queries, but I have had to hire someone to analyze those logs and do whatever might help.

    Caching is one of the first tools used to scale web sites. Your mileage is definitely going to vary depending on your circumstances (shared hosting vs VPS, number of course, amount of RAM, if MySQL is on same or different server, etc), but with caching you’ll eliminate most database calls (after the page is cached the first time) and basically be serving static HTML, so PHP won’t have to do any processing. In some cases I’ve had better luck caching DB queries (using DB Cache Reloaded) than with the normal caching plugins like W3 Total Cache or WP Super Cache. I normally don’t cache unless I have to (and with shared hosts, I often have to). A default WP theme with no plugins shouldn’t give you to many DB queries, but themes and plugins can up the number considerably, especially if the theme or plugin is written poorly (I say that because I had a premium theme that did 100+ writes with every page request due to the theme author using the wrong hook in the theme, and the theme reinitialized itself with every page call). It could be many things, but slow queries will really cause CPU issues and bog your server down (which could be caused by missing indexes in your tables).

    …slow queries will really cause CPU issues and bog your server down (which could be caused by missing indexes in your tables).

    That is exactly what I was told.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Will caching help decrease CPU load?’ is closed to new replies.