Awhile ago, I ran into problems with my web hosting company. According to them, my main site (Embedded Star) was consuming too many CPU resources. It happened several times so they suspended my site. My main site has decent traffic, but not Digg type of traffic. There really wasn't a good reason why my site would consumed too many CPU resources. I figured there must be a problem with the ISP so I moved to another ISP. A few months later, I ran into the same problem. So, I upgraded to a semi-server plan where I shared a web server with three or four other people (instead of hundreds of sites on a single server). A few months later, the web hosting company again informed me my site was consuming too many resources. So I decided to get a dedicated server and put all my sites on it.
With a dedicated server, I figured my troubles were over. Wrong! Multiple times each week, my server would overload and become non-responsive or very slow. After I analyzed my web logs and removed some apps, I realized a big part of the problem had to do with all the WordPress plugins I was using. Plugins give us extra functionality, but many of us (including me) don't realize the extra load they can place on the server. BTW, even the theme templates we use can also add to the load. For instance, the old Default (Kubrick) theme generates an extra five SQL queries compared to the new Twenty Ten theme:
Home Page
- Twenty Ten 1.1 theme: 10 queries, 0.5298 seconds
- WordPress Default 1.6 theme (Kubrick): 15 queries, 0.6334 seconds
Single Post
- Twenty Ten 1.1 theme: 15 queries, 0.5492 seconds
- WordPress Default 1.6 theme (Kubrick): 15 queries, 0.3434 seconds
I also tested several WordPress plugins to see what kind of load they generated. Below are the results of my tests. I loaded the pages five times for the home page and five times on a single post (same post each time). Occasionally, there was a spike in the query count but I ignored those spikes because they were rare and not repeatable. I want to point out that the Get Recent Comments widget generated one fewer query than the Twenty Ten theme by itself. I have no idea why, but the results were consistent each time I reloaded the page.
| WordPress Plugin | Additional Load |
| RSS Import 4.4.9 (home) | +4 queries |
| RSS Import 4.4.9 (single) | +4 queries |
| WP-Polls 2.60 non-widget (home) | +5 queries |
| WP-Polls 2.60 non-widget (single) | +5 queries |
| WP-Polls 2.60 widget (home) | +4 queries |
| WP-Polls 2.60 widget (single) | +4 queries |
| Efficient Related Posts 0.3.6 (single) | +5 queries |
| Get Recent Comments 2.3 non-widget (home) | +5 queries |
| Get Recent Comments 2.3 non-widget (single) | +5 queries |
| Get Recent Comments 2.3 widget (home) | -1 query |
| Get Recent Comments 2.3 widget (single) | -1 query |
| Akismet 2.5.1 | +1 query |
| Contact Form ][ 2.0.14 | 0 query |
| Exploit Scanner 0.97.5 | 0 query |
| FeedBurner FeedSmith 2.3 | 0 query |
| Google XML Sitemaps 3.2.4 | 0 query |
| Head META Description 1.1.2 | 0 query |
| Ozh' Better Feed 2.2 | 0 query |
| replyMail 1.2.0 | 0 query |
| Smart Update Pinger 2.0 | 0 query |
| Unfancy Quote 3.0 | 0 query |
| WordPress Database Backup 2.2.3 | 0 query |
Before a WordPress developer flips out, I want to be sure to say I'm not blaming WordPress plugins for my server problems. However, I do think they added to the problem when a bunch of aggressive bots crawled my sites. Before I removed some of the plugins, each page they crawl would generate 30+ SQL queries and the bots would fetch hundreds of pages a minute. As a result, my server became overloaded with thousands of queries a minute during the bots crawlfest. Yeah, I know. The main reason for my server problem is the aggressive bots, but my server rarely overloaded after I deactivated many of the plugins. [Note: I couldn't find all the plugins I use to use and the plugins above are not necessarily the ones I used in the past. I'm only using them for illustration purposes.]
In conclusion, I just want to say you should take a look at the plugins you use if your server is having an overload problem. Oh yeah, add this code at the bottom of your page to see the impact of a plugin:
<?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?>