Last week we began noticing a problem on Throng. Some pages were taking a ridiculous time to load (~3 minutes!) all of a sudden. We hadn’t changed any code recently, so checked in with our host, Media Temple. We’ve had a few headaches with them as a host this year as their grid service had some serious growing pains but this time, everything seemed to be OK from their end.
We scratched our heads and tried all sorts of things: we put the site in offline mode and turned off all the ad server code we were using, just in case there was a problem with one of their servers. No change: still 3 minutes to load some pages. And during those 3 minutes, nothing on the page displayed at all. We installed the devel module which helps identify database problems and load times. We added in timers at various parts of the template to find out where the problem was occurring. Still no clues. We turned off lots of modules to see if it was one of those. We tried using Firebug and the Web Developer Toolbar extensions for Firefox to see if it was any of those. We went on the Drupal irc channels and talked to some people who thought it was the host’s problem, not ours. I wasn’t convinced.
Someone gave us a vital clue: a 3 minute time to load sounded like a timeout on an external service of the default of 180 seconds. We finally remembered about the Digg This module that we’d been using for some time on the site, without problem. Turning this off solved the problem!
I wanted to understand why a module like this could suddenly bring a site to its knees and why it happened all of a sudden.
Looking through the module’s code, there is a snippet which interacts with Digg’s API:
function _request_diggthis($url) {
global $digg_story_url;
$request_url = 'http://services.digg.com/stories?link='. $url;
$ch = curl_init($request_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec($ch);
$xml = ob_get_clean();
curl_close($ch);
...
After some googling, I found there are others out there who are saying that Digg changed its API last week and it stopped their 3rd party Digg this plugins from working on WordPress as well as on Drupal. If Digg has changed its API and broken a lot of people’s code, then that seems like a big deal to me. Meanwhile, Digg has recently provided more and more ways of having a Digg this button on your site with some simple code.
I’ve submitted an issue for the Digg This module for Drupal and hope that others won’t have the same headaches that we’ve had trying to find the source of the problem!