$ cat post/a-ticket-unopened-/-the-rollout-was-never-finished-/-root-remembers-all.md

a ticket unopened / the rollout was never finished / root remembers all


Title: Debugging Digg’s Growth Spurt


January 16, 2006 was just another day when suddenly the servers started screaming. You know those late nights in the data center? Well, it was one of them.

The Setup

We were running a small social news site called Digg on top of an LAMP stack with Xen hypervisors for our development and staging environments. Our production environment had two main machines—Apache load balanced across two servers, MySQL databases galore, and a custom-built Python script handling some of the more complex logic. We used to joke that every time there was a big story, we would get 10x the usual traffic overnight.

The Incident

It started innocently enough; the site had been relatively quiet over the weekend. But by Monday morning, we were getting reports of slow performance and weird crashes. Users complained about being unable to log in or see stories properly. As someone who always checks logs first, I jumped on a server and started looking at Apache access logs.

The access logs showed a flurry of requests from what seemed like all over the world, but nothing unusual in terms of URLs or patterns. However, looking at MySQL slow query logs, I saw some queries that were taking way too long—specifically those hitting our user table for login attempts and profile information.

The Investigation

I quickly switched to the development machine and fired up a SQL client to see if we could get more insights. Running EXPLAIN on these queries revealed that they were mostly hitting an index that was not as well-designed as it should have been. The culprit? A poorly optimized query in our login script.

But here’s where things got interesting. We had some caching mechanisms in place, but the issue wasn’t just about slow queries—it was a full-on server thrashing. I checked CPU and memory usage; they were both maxed out, but it felt like there should be more to it.

The Discovery

After much head-scratching, I turned to our application logs. There, in plain sight, was the key: every login attempt was being logged as a new event, which meant we were hitting the database for each and every one of those requests! And with thousands of users logging in over just a few hours, it wasn’t surprising that everything had ground to a halt.

It turned out our custom logging mechanism was causing more harm than good. I rolled up my sleeves and started rewriting the code to use a batched logging system instead of hitting the database on every request. This required some refactoring, but once done, we saw immediate improvements in performance.

The Aftermath

In the days that followed, I spent time optimizing other parts of our stack as well. We upgraded to newer versions of MySQL and Apache, tweaked configuration files, and even added more hardware resources. By mid-February, things were much smoother. Digg was growing, but we had learned a valuable lesson about scaling gracefully.

Looking back, this event taught me the importance of:

  1. Proper Indexing: Ensuring that database queries are optimized for performance.
  2. Efficient Logging: Implementing logging systems that don’t become bottlenecks themselves.
  3. Performance Monitoring: Continuously monitoring and adjusting to handle growth.

The tech world was changing rapidly—Xen hypervisors, open-source stacks, and Python scripting were becoming the norm. But at Digg, it was still about solving real problems with pragmatic solutions.


Debugging those servers taught me that while tools like Xen and LAMP were great, the real magic came from understanding your application’s behavior under stress and making intelligent decisions to handle growth. It’s always a learning experience, and 2006 definitely had its fair share of lessons.