Four mongrels, digg, and lifehacker
Hotspotr had a record-breaking day yesterday, with a total of 61,000 pageviews according to Google Analytics. The peak hour was 5pm, shortly after it went onto the digg homepage, with just under 15,000 pageviews in one hour.
Since a frequently-expressed concern with Rails is it's ability to handle traffic, I'm happy to say the site survived without a hicup. If you are building a Rails app and wondering about scalability, here are some points of reference:
- the backend is Apache 2.2 with mod_balancer going to a cluster of four mongrels.
- the server is a Rimu hosting dedicated server, with a few other Rails apps running alongside it (none very highly trafficked yesterday though).
- I don't have quantitative measurements on its responsiveness during the peak load times, but qualitatively it seemed pretty snappy -- I hit the site myself repeatedly during the peak time to see how it was holding up.
- the hotspotr homepage has four database queries. The main map page (for any given city) has five queries.
- I've done very little to optimize hotspotr. The basics are there: no iterative retrievals, appropriate indexes on tables, and sessions in the database.
- beyond that, I haven't optimized much at all -- there's no caching of either ActiveRecord objects or HTML fragments.
You can see there is still quite a bit of room for improvement. The fact that the site survived a 15K hour certainly makes me more confident about deploying Rails in a high-traffic environment.
Thanks to Josh at Webware Rick at lifehacker for writing up hotspotr and sparking all the traffic yesterday!

Comments
Scott Robbin on Feb 27
Congrats! That's great news....amazing traffic stats.
I love Hotspotr. I've added it to my Tappity.com mobile homepage.
Shimon Rura on Feb 28
High traffic?
In your peak hour with 15k pageviews, you handled 4.167 pageviews a second. I'm glad nothing bad happened -- Hotspotr is a cool and useful site -- but crashing under that sort of load would have been truly pathetic.
Things start to get interesting at around 10x that kind of traffic. With some luck, you'll get there soon and I look forward to a follow-up report. :)
teki321 on Feb 28
If I understand well:
15000(req/h) / 4(machine) / 60(min) /60(sec) = 1 request/sec/machine ?
Andre Lewis on Feb 28
teki, all four mongrel processes are running on a single physical machine. So yes, it's one request/sec/mongrel, but 4 requests/second on the physical server.
Ryan on Feb 28
Just curious, do you know the specs for the server that you're using? Also, any idea what its limiting factor is -- CPU power, RAM, bandwidth?
teki321 on Mar 01
And 4 request/sec is a good performance in the web world ?
(I am just curious, I don't have any serious website.)
I assume the peak performance statistic is more interesting than a 15k/hour one.
Kyle on Mar 02
teki, 4 request/sec is not something to brag about but it is not bad. Although 4 r/s isn't that much compared to digg or /. or myspace, most websites don't ever even hit 1 r/s.
So that stat is good for the site but it doesn't prove much on how well ruby/mongrel holds up. I develop in Ruby though so I can tell you a single mongrel instance can handle quite a bit more than that depending on the application code and DB. In most cases it is not ruby it self that makes a website run slow. It is how it is set up, what the application is doing (rmagick=>bad), and how much work the DB has to do.
Scott McMillin on Mar 06
Great news, Andre. We're looking at a Rimu dedicated right now and were wondering what specs you have (ram, cpu, distro, etc)?
Also, the Google Maps book is fantastic - thanks for that.
Andre Lewis on Mar 22
For some reason a bunch of these comments when into my junk folder -- sorry about that.
@teki, @Shimon -- 4 req/sec is decent for an app that hasn't been optimized much. Also, I imagine that even during that peak hour, there was an even more concentrated peak time, probably when it was first promoted onto the digg front page. Since the "digg effect" brings down many web sites, it's reassuring that hotspotr stayed up.
By the way, I looked back at my server config, and I have three mongrels running the site, not four.
@Scott, Ryan -- the server specs at Rimu are: AMD Athlon64 3000, 1GB memory, centos4 distro.
When I have time, I need to do some methodical stress testing to see when it would actually break. My sense is that I've got quite a bit of headroom still, and I can make more by optimizing some code, using memcache, and throwing on some HTML fragment caching.