Strictly Google Sitemap Wordpress Plugin

Version 1.0.7

Strictly Google Sitemap Wordpress Plugin Buy the Strictly Google Sitemap Wordpress Plugin

Strictly Google Sitemap is a Wordpress plugin that I developed specifically because I was having trouble with the existing available Sitemap plugins. Although there are a couple of good plugins out there in terms of features or simplicity they seem to suffer issues when it comes to memory usage. If you have ever experienced out of memory issues with your Sitemap plugin then the Strictly Google Sitemap plugin could be for you.

Problems with Wordpress Plugins

Because most Wordpress Plugin developers only concentrate on the code they are interested in they can create some very resource intensive applications and plugins without realising it. This is especially the case with Wordpress which is designed in such a compartmenilised way that it means it's very easy to write code that can hurt performance with just a few calls to the Wordpress API.

Whilst Wordpress is a great Content Management System fresh out of the box it is not the best performance wise and you have to do some serious configuration to get it to perform well. For small sites that receive little traffic the combination of an un-optimised Wordpress setup and multiple active plugins might not be too much of a problem however for sites that do receive a lot of traffic it can be fatal. Add to this equation a shared hosting or virtual server setup with 1GB or less of RAM and you have the potential for high server loads, out of memory errors, site freezing, database connection errors and long query execution times.

I wrote the Strictly Google Sitemap plugin after I started experiencing similar problems whilst using a number of the existing sitemap plugins on one of my busiest systems. Whilt I had no issues at all on my quiter site my larger one started to experience intermittent out of memory errors, hanging webpages and high server loads. Whilst I won't categorise all the current sitemap plugins together they do follow similar build and execution patterns which can often lead to problems. These performance issues are often exacerbated when other popular plugins are thrown into the mix or the server is already under stress.

Problems with Sitemap Plugins

One of the biggest issues with the design of Wordpress is that code that logically should only be called once gets called multiple times and this leads to wasted resources and excess database queries. Whilst this is not the fault of the Plugin developers who are just using the inbuilt Wordpress API methods it does lead to a very high number of database queries which means extra resource consumption including the network traffic back and forth, creation and destruction of arrays to hold the results and the repeated function calls.

The existing Sitemap plugins offer a great illustration of this problem as the following comparison chart shows. Whilst my own plugin makes the same number of database queries no matter what number of records are contained within the sitemap the others have a direct corelation between the two.

I have compared three Plugins of varying complexity including the market leader, a basic version and my own. The tests were carried out on 2 different production systems one of which was a very small site with few posts and the other which 7000+ and attracts thousands of visitors a day. I also compared two different permalink structures, one an overly complex structure and the other a commonly used structure. For each plugin I selected all the available options so that as many records as possible were outputted.

Sitemap Plugin Comparisons

Using the following permalink structure:


Plugin Records DB Queries Memory Usage
Google Sitemap Generator 193 199 16.75 MB
Google Sitemap Generator 7151 4858 48.5 MB
Simple Google Sitemap 185 369 19.5 MB
Simple Google Sitemap 4815 9612 188.5 MB
Strictly Google Sitemap 199 7 16 MB
Strictly Google Sitemap 7200 7 36.75 MB

Using the following permalink structure:


Plugin Records DB Queries Memory Usage
Google Sitemap Generator 193 16 16.75 MB
Google Sitemap Generator 7151 61 48.5 MB
Simple Google Sitemap 186 186 19.25 MB
Simple Google Sitemap 4815 4815 146 MB
Strictly Google Sitemap 199 7 16 MB
Strictly Google Sitemap 7200 7 36 MB

As you can see the results can be quite striking especially with larger sites. I wouldn't expect to see much difference in terms of performance for blogs with small numbers of articles apart from the number of database queries but as a site grows and traffic increases it's worth squeesing as much performance as possible out of the hardware and software that you have before having to resort to upgrades.

Another problem with the existing sitemap plugins is that they all rely on hooks into the actions fired when a new post is published or deleted to initiate the rebuild. Whilst this is perfect for blogs where very few articles are added on those that publish a lot of content it can be an overhead that can cause serious performance problems.

Imagine you have an average news based site with 10,000 articles. You use a popular feed import plugin to import 10 news articles every 30 minutes. You also have another popular related posts plugin that provides your readers with a list of links similar to the article they have just read. What happens when you import your next batch of articles?

  • Your Wordpress Feed Importer Plugin loads the feed into memory and loops through the ten items one at a time
  • Each article in the feed gets saved into your Wordpress blog. This fires any actions hooked into the publish event.
  • Your standard Google Sitemap plugin uses such a hook and a 2MB (estimate for 10,000 articles) file is built ten times, once after each posting.
  • The sitemap is built by looping through each one of the 10,000 articles in turn formatting the data
  • This involves calling other Wordpress functions that make their own queries to the databsse.
  • Your related post plugin also fires at this point running a large query that scans all your existing articles looking for relevant content and ranking it.
  • You may have other plugins that add smart tags, rebuild feeds or fire messages off to Twitter or Facebook.

You can see how this common scenario can be a major flashpoint and tests on my own servers have shown that during a scenario such as the one described the server load average can jump from a very quiet 0.01-0.10 up to a stressed out 1.00-10.00+(maxed out * 10). Whilst the average server load is a measurement of many things and a jump could be caused by any number of processes running at the time of measurement a consistent high increase at the time of running a script is a good indicator that it is problematic.

A common solution offered for plugins that cause memory issues is to just raise the available memory limit high enough so that errors are not raised. Whilst this may seem to resolve the error it is only masking the underlying issues and is also shifting the problem elsewhere. If you are limited by memory then giving all your available resource to one process means others will be unable to run correctly. Whilst you may want mission critical processes to have as much memory as they require to accompluish their task giving it too much could cause problems elsewhere and it's always much better to resolve the underlying problem if possible.

Why is my plugin different from the others?

As you can see from the sitemap performance comparison results the difference between my own Plugin and the others could make all the difference on systems already under stress.

The way I have done this is by switching the majority of the load away from the PHP code to the database. Whilst the other plugins loop through each sitemap record one by one formatting the permalink and making extra calls to the database per item I have accomplished all of this by carrying out one large query per record type rather than hundreds of little ones. Whilst the amount of memory used by MySQL during this query will increase it should be for a second or two at most. Not only does this reduce the number of database queries it also reduces the amount of memory consumed by PHP and the number of other function calls that the other plugins unneccessarily repeat on every iteration of the loop.

My plugin also solves the problem of rebuilding the sitemap unneccessarily such as during the import of multiple articles from feeds by offering the ability to rebuild at scheduled intervals. Setting the sitemap to rebuild at timed intervals by using a Cron job is the ideal way to ensure that you don't overload your servers at critical times. For those webmasters who don't have access to their server to setup a Cron job I have built in the ability to use a WebCron service or use my own in built scheduler system that relies on page requests to initiate the job.

As well as offering all the usual features you would expect from a Google Sitemap generator my plugin offers a number of features that the other plugins don't currently offer which are useful for webmasters running large Wordpress systems.

  • Automatic memory configuration

    Set a minimum and maximum level and then let the plugin adjust the amount of memory required whenever it's needed. Whereas other plugins just raise the limit to an arbitraly high amount whether or not it's required this plugin will keep the memory limit to an appropriate level by checking and changing the allowed memory limit on each build.

  • Sitemap Index

    Specify the amount of records per sitemap (up to 50,000) and let the plugin create a sitemap index file that links to the required number of sitemaps.

  • Custom PagesAdd any number of custom pages or files to the sitemap. Many large sites have files that have not been created by Wordpress but still need to reside in the sitemap.

  • Built in reporting and analysis

    The plugin constantly checks your site setup, plugin configuration and sitemap content to ensure it's valid and beneficial for your systems performance.

Purchase the Strictly Google Sitemap Plugin

If you interested in the performance benefits and additional features that the Strictly Google Sitemap plugin offers then you can purchase a copy of the plugin for only £15.

Buy the Strictly Google Sitemap Wordpress Plugin