Syndicated content has almost become the standard way of distributing web content nowadays. WordPress can deliver its content in various different feed formats –RSS 2.0, Atom 1.0, RDF, RSS 0.92– and can generate feeds for both the published posts -grouped by time, category, tag, author etc- and the comments that have been submitted by readers. Moreover, some RSS add-on modules are being used in the generated feeds, so that modern feed readers can even retrieve the submitted comments for each of the feed entries. It is obvious that all these features greatly enhance the user experience, but, on the other hand, depending on the website’s traffic they might increase the server load and thus the content delivery times.
Taking these things into consideration, I decided to write Fast-Static-Feed, a plugin that can cache the site’s entries feed, and deliver a static XML file instead of constantly generating the feed content on every client request. This, combined with the fact that the web server can compress the web content on-the-fly, has greatly reduced the waste of bandwidth and system resources.
How it works
Fast-Static-Feed performs the following actions:
- Every time a post is published or an already published post is edited, the plugin dumps the entries feed (that is the feed of the blog posts) to a file. This way, the static XML file is always contains the most fresh content of your blog.
- Every time a feed is requested, instead of re-generating the XML content over and over, this plugin delivers the static XML file. This is completely transparent to the client as there are no HTTP redirects involved. Your content is just being delivered faster!
- If the plugin is enabled, but the static files have not been created yet, the plugin will try to generate them automatically. Upon failure to do so, a
404 Not Found
HTTP error code will be returned to the client. - It also checks if the client’s request includes the If-Modified-Since HTTP header and, in such a case, it checks the static file’s modification time. If the client’s cache is current, it just returns a
304 Not Modified
status to further reduce bandwidth usage.
The plugin caches all four types of feeds WordPress supports –RSS 2.0, Atom 1.0, RDF, RSS 0.92-.
Only the feeds that contain your blog posts are cached. The comments feed, each individual post’s comments feed, feeds for categories, tags, authors etc are still generated dynamically every time they are requested.
This plugin does not interefere in any way with the generation of rewrite rules and the generation of your site’s feed links.
Configuration
Generally, the plugin does not require any configuration in order to work.
One mandatory prerequisite is that the wp-content/
directory is writable by the web server. If it is not, the plugin will not be able to create the static files and, consequently, the clients who request a feed will receive a 404 Not Found
HTTP code.
Furthermore, there are two options within the source code fast-static-feed.php
that can be set.
// By default, the WordPress feeds contain elements of the 'wfw' namespace // (CommentAPI), so a feed reader can fetch each feed entry's comments. // By setting the following to 1, these elements will be stripped // from the static feed. // It is recommended to set this to 1 in order to save bandwidth. // More info: http://wellformedweb.org/news/wfw_namespace_elements/ $FSF_STRIP_COMMENTS = 0; // Set the following to 1 and various messages will be recorded in the logfile, // which is located in the cache dir (wp-content/cache-xml/) $FSF_DEBUG = 0;
It has already been mentioned, but it is important to note it again: The only mandatory prerequisite is that wp-content/
is writable by the webserver.
Installation
Make any changes to the configuration options within fast-static-feed.php
and upload the file to wp-content/plugins/
directory. Then, activate the plugin through the WordPress administration panel.
License
Fast-Static-Feed is an open-source project, released as Free Software under the terms of the Apache License version 2.
Downloads, Issue Tracking, Support
For the latest releases of Fast-Static-Feed please visit the Fast-Static-Feed development web site.
This plugin is not available on the WordPress Plugin Repository.
This project is no longer supported. Submitting support requests, issue reports or feature requests is not possible at this time.
Development Status
This plugin has been discontinued. The functionality implemented by this plugin should be considered outdated and not tested with recent releases of WordPress. It is highly recommended to use one of the modern caching plugins available through the WordPress Plugin Repository.
Fast-Static-Feed WordPress Plugin by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2008 - Some Rights Reserved
Looks good. Do you have any comparisons?
Generally the rss feeds to not create a lot of load or problems as the reader is not waiting for a page to load or somesuch. Unless you are really running into CPU or MySQL issues I don’t see a big issue.
I tried to measure the difference in performance across the LAN, so that the slow internet connection is not an issue. When the plugin is enabled, the static feed is delivered around 7 to 7.5 times faster than the dynamically generated one. I used ab and curl (timed with the
time
command) and both showed almost the same result.Here is the partial ab output which shows the difference in performance:
The following is the result with the dynamic feed:
Here follows the result with the static feed (plugin enabled):
You can see the big difference in the “Time per request” fields. The results are almost the same even if I increase the concurrency of the requests, but I guess this also depends on the Apache configuration options that have to do with the the number of concurrent connections.
In real world conditions I agree with you. The feeds are not the actual problem.
In my case though, this website is hosted on a very slow connection and I needed to reduce the bandwidth consumption produced by feed readers to a minimum. It’s not the extremely high traffic that causes the problem with the bandwidth. My site’s traffic hasn’t changed over the last months. But, all those features inside the feeds, like comment retrieval, and the fact that, despite the rare content updates, there are still clients that refresh the feeds at small intervals such as 5 minutes are the real cause of the problem. Now, using this plugin the server just returns a 304 Not Modified HTTP code instead of returning the unchanged content.
Anyway, this whole thing is a bit experimental. I just want to check if it is any good to keep this plugin enabled :)
I should mention that the above tests were performed on a Pentium II (350MHz) with 512MB RAM. Perhaps the difference in performance is not that big on a high performance server.
Version 0.2.0 is out.
I also think that RSSar very usefull. They help visotors and alsow search engines (faster website crawling) and from my expirience CPU load is minimal.
I was hoping to find a mod for ENABLE / DISABLE rss and all FEEDS… bud… this is BIG…. search google …. a lot are looking for a quick fix to turn on and off FEEDS …. link back to me if you have something….
how do i make wp-content/ writable by the web server?
You can make wp-contents writable with the command:
I’ve published a small article about how to make a file or directory writable by the web server process.
This looks great, I guess. I’m getting the following error, when i run the php file:
Fatal error: Call to undefined function add_action() in /wp-content/plugins/fast-static-feed.php on line 199
Is there an updated version of this plugin or a similar plugin that does the same thing, with wordpress changing all the time it is hard to keep up with all the changes.
@Fisher: I currently use WP-Super-Cache which also caches the xml feeds, so there is no need to use or further develop this plugin.