7/12/2008 ↓

How many Queries are too many? 35comments

Author: Mark Ghosh Category: Blogging, General, WordPress

Thanks for visiting! We would like to serve you better. Please subscribe to our RSS feed for daily updates. This blog posts regular Wordpress news, updates of themes, plugins, ideas, hacks, quick fixes and everything about blogging, especially about Wordpress. You can also receive updates from this blog via email if you want that method of notification.

I have been asked this question quite a few times and I never have a perfect answer. It is obviously an important question to ask but it can be answered in many different ways based on preferences, need for plugins, optimization techniques used and a variety of other factors.

Weblog Tools Collection uses a lot of plugins and is very query heavy but the in spite of that, the front page uses 59 queries to generate itself. I think the default (on a vanilla WordPress install on the default theme) is 27 or something of that nature. The larger the number of queries, the slower the page is going to load and the more load you are going to put on your MySql server. All of the above is true if you do not use inline or regenerative caching mechanisms. The caveat on this blog is that its plugins and its MySql server are highly optimized (via inline caching mechanisms) to reduce load.

Larger number of queries on a WordPress blog are probably caused by plugins that have been installed. Plugin authors can have non-optimized and useless queries that either take a long time to execute or need a large(r) number of queries to acheive a simple(r) result. I suspect that one could follow the 80-20 rule with 80% of the queries on your blog being generated by 20% of the plugins. If you can identify the top hitters and either optimize or replace them, you will have a happier blog and a happier MySql server.

It is also important to remember that the number of queries might not be the only straw that is breaking the camel’s back. SQL queries can be poorly constructed and can put a tremendous drain on resources. I remember a certain recent comments plugin that made queries which scanned entire tables before producing a result. If you are concerned about the speed of you blog or the number of queries, start disabling plugins. You might be pleasantly surprised to find that a few plugins might be causing most of your headaches. Once you identify the suspect plugins, you can then either find replacements that are more oprtimized or find other ways of obtaining the same result.

How many queries does your font page generate? If you find efficiencies by disabling plugins, please tell us about the results.

6/22/2008 ↓

Andy Skelton Introduces Batcache 8comments

Author: Jeff Chandler Category: Wordpress Plugins

So far, there are two excellent performance enhancing caching solutions available for WordPress, WP-Cache and WP-SuperCache. Both do an awesome job of caching posts/pages to help keep your website from falling off the map in the middle of a Digg effect. Now, there is a new entrant in the caching arena called Batcache which was created by Andy Skelton.

This plugin is meant to be used in situations where file-based caching is either not practical, or is not desired. According to Andy, development testing showed a 40x reduction in the time it took to generate pages. Pages that were generated in 200ms ended up being served from the cache in only 5ms.

Batcache uses Memcached to store and serve rendered pages. It’s not as fast as Donncha’s WP-Super-Cache but it can be used where file-based caching is not practical or not desired.

The basic premise of the plugin works similar to the other caching plugins that are available:

Batcache is aimed at preventing a flood of traffic from breaking your site. It does this by serving old pages to new users. This reduces the demand on the web server CPU and the database. It also means some people may see a page that is a few minutes old. However this only applies to people who have not interacted with your web site before. Once they have logged in or left a comment they will always get fresh pages.

Andy has also noted that the following features could be implemented in future versions of the plugin:

  • Comments, edits, and new posts will trigger cache regeneration
  • Online installation assistance
  • Configuration page
  • Stats

So if WP-Cache or WP-SuperCache is not helping your situation, give Batcache a try and please, let us know how it works for you in the comments.

Friends

Translate

Translate to German Translate to Spanish Translate to French Translate to Italian Translate to Portuguese Translate to Japanese Translate to Korean Translate to Russian Translate to Chinese

Latest Videos

S2