How Django Deals With a Hacker News Frontpaging

by anders pearson Sat 02 Jun 2012 17:25:35

A post of mine from last year just made it onto the front page of Hacker News. This site is generally pretty low traffic so it was quite a surge. Check out the munin graph of the network activity on the server:

network traffic

It spiked up to around 1Mbps for a while.

I run this blog on a fairly low-end 512MB Rackspace Cloud VPS and it's implemented in Django (behind Apache/mod_wsgi, and talking to a PostgreSQL database) without any real attention ever paid to optimization. I don't do any caching or static publishing, so every request is processed through Django, and I run about a dozen different dynamic Django apps on the same server.

So how did it handle the surge in traffic? Did the CPU melt?

Here's the CPU usage graph from the same time period:

CPU traffic

Yeah... if you look real closely at the right there, you can kind of see that it increased a bit. But it was basically negligible. Memory usage and swap activity didn't show any changes either.

If my email inbox hadn't suddenly filled up with comment moderation emails, I'd probably never even have known anything was going on.

TAGS: performance django

formatting is with Markdown syntax. Comments are not displayed until they are approved by a moderator. Moderators will not approve unless the comment contributes value to the discussion.

remember info?