8 Ways to Save Bandwidth on your RSS Feed
One of the things you will notice after you have published an rss feed is that it will consume a lot of the bandwidth. For example on Spendfish.com 18% of the requests are for RSS feeds. This is no wonder since feed readers may download your feed several times a day even if nothing has changed.
I've put together a list of ways you can save bandwidth and reduce the number of requests to your RSS feed (which also saves server processing).
1 - Use the
ttl tag goes directly inside the
channel tag in your RSS feed. It stands for time to live, and should hold the number of minutes a RSS reader should wait before requesting your feed again. Most blog software defaults this setting to
60, which means that your feed will be downloaded every hour by clients that obey this setting. We can increase this to 3 hours by adding the following:
Read more about
2 - Add a
skipDays tag also goes inside the
channel tag and should contain several child
day tags. As you might guess this tells RSS readers to skip downloading your feed on the specified days. For example if you don't publish content on the weekends:
<skipDays> <day>Saturday</day> <day>Sunday</day> </skipDays>
3 - Add a
Same idea as the
skipDays tag, but allows you to specify which hours during the day your feed should not be downloaded. The hours are specified in 0-23 using GMT. For example since I'm in NY, and I typically don't post things to my blog very early in the morning I could add:
<skipHours> <hour>7</hour> <hour>8</hour> </skipDays>
More info about
4 - Support
Many RSS readers and clients send an
If-Modified-Since header in their request to your RSS feed. This is one of the ways clients make what's called a conditional HTTP GET, you can return a
304 Not Modified HTTP response code (and omit the request body) if the RSS feed has not changed since the date specified in the
If-Modified-Since header. If the content has changed you simply return the normal
200 status code.
The header sent by the client might look something like this:
If-Modified-Since: Tue, 10 Jul 2007 21:19:55 GMT
5 - Support
If-None-Match HTTP headers
ETag header is a HTTP response header that you can send back in your RSS feed response. It stands for entity tag and should be a unique value representing the content, you could do a MD5 hash of your RSS feed content, or simply use a date time of the last change. Clients will send this back in a
If-None-Match header, if this header contains your current ETag then you can return a
304 status code. More info about
6 - Don't send the request body on HTTP HEAD requests
Here's what HTTP 1.1 has to say about the
The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response.
HEAD method should only return HTTP headers, and no request body (so you don't need to return your entire RSS for these types of requests). You will find that several aggregators and readers will make
HEAD requests for your feed (including MXNA), it's a simple way to save some bandwidth.
7 - Limit the number of items you publish
This one is kind of obvious, but it is a very easy way to save bandwidth in your rss feed. If you are publishing 15 items or articles in your feed, if you lower that to 10 you can save a good amount of bandwidth.
8 - Publish Partial Content feeds
Another obvious way to save bandwidth - don't publish full articles in your feed. By publishing just the first few sentances of content you can also save a good amount of bandwidth. Your readers may not be too happy about this one however.
Do you have any other techniques that work? I considered adding
Cache-Control, but I wonder if that would actually take away the savings you would get from a Conditional Get?
I have to thank Charlie Arehart for giving me the idea for this blog entry. After my Working with RSS in ColdFusion presentation at cfunited he suggested that I write a blog entry on ways to reduce the bandwidth consumption of your RSS feed. After doing the research for this entry I realize that this topic could the subject of an entire presentation!
- The MySQL Query Cache - June 21, 2005
- Cache Template in Request Setting Explained - February 25, 2010
- Foundeo's 2007 End of the Year Sale - December 21, 2007
- Yahoo Pipes Generates Invalid RSS Feeds - February 22, 2007
- MySQL Optimization Hints - January 2, 2007
- ColdFusion defaults avoid flawed Random Number Generator
- Apache Security Patches on CentOS / RHEL
- FuseGuard 2.4 Released
- New HackMyCF Features
- Blocking .svn and .git Directories on Apache or IIS
- CFDocs site now Open Source
- Getting Size of Heap and Non Heap Memory in CFML
- Firefox Aurora now Supports Content Security Policy 1.0