Fixing WordPress Feed timeout issues

Recently I got an email from my friend Sudheer, saying that the feedburner feed of my blog is not working. I thought it might be some small issue, but it took me more than a couple of hours to fix it. As usual, I thought of documenting it since it was an interesting problem and also someone who has the same problem might also find it useful.

WordPress feed timeout

I started the debug process by logging into Feedburner dashboard. Feedburner reported that it is not able to fetch my blog’s feed url. When I tried to open the feed url directly in browser it was loading, but it took a couple of minutes for WordPress to generate it. But both feedvalidator and feedburner said that the feed times out.

My website was loading properly and my error log was empty. I tried lot of different things but was not able to figure out why the feed was timing out.

Increasing memory used by WordPress

After a couple of web searches, I landed on a old forum thread, which stated that we should try to increase the amount of memory used by WordPress. I tried doing that as well, but it didn’t make difference 🙁

Reducing post count in feed

Then I tried to reduce the number of recent items that were shown in my feed to 10 from the default value of 25. The feed was getting generated in some decent time and was able to let feedburner pick up my feed. But it still didn’t solve my original issue.

Unoptimized Plugin

After some more debugging, I found the root cause of the issue. An unoptimized Plugin was the real culprit.

I was using github’s gist to store the code samples that I use in my blog posts and used a Plugin to embed the code directly from github. The advantage of this approach is that, there is one centralized repository for my code samples with versioning and also github provides nice syntax highlighting.

The Plugin was making curl request to github to retrieve the code sample and it so happened that most of my last 25 blog posts had code samples and some blog posts even had around three code embeds.

The problem with the Plugin was that, it was not using WordPress’s built-in HTTP request object and also it was not caching any of the response that it got from the curl request. I quickly rewrote the Plugin and WordPress was immediately able to serve the feed in less than a second. (Will be releasing the Plugin pretty soon) Update: You can find the Plugin in its homepage

Solution

So if you are also facing timeout issues with your WordPress feed, then try the following

  • Try increasing the memory used by WordPress
  • Try reducing the number of blog posts that are disabled in your feed.
  • If nothing works, then it’s mostly because of some unoptimized Plugin.

Related posts

Tags: , , , ,

2 Comments so far

Follow up comments through RSS Feed | Post a comment

1 Tweetbacks so far

1 Trackbacks/Pingbacks so far

Leave a Reply

Your email address will not be published. Required fields are marked *