Will Ruby and Rails Scale?
We're not worried about scaling.
So, inevitably, whenever we talk about Ruby or Rails scaling these days, someone brings up Twitter and its scaling problems in the past. Twitter is right down the block from our offices and I know several of the devs personally, so before we made a final decision I arranged a sit down with Twitter's lead developer, Blaine Cook, to talk about the situation. Blaine was kind enough to let me bring along our Search Architect (and former search architect at Yahoo!) Chad Walters, our Head of Product Scott Prevost, and our COO Steve Newcomb, to poke and prod and get their questions answered. The simple fact is that Ruby wasn't the source of Twitter's woes. As it often happens with rapidly-growing sites, they ran into architectural problems. Some design decisions don't hurt until they reach a massive scale and, at that point, you have to rethink your approach. In an email he writes:
For us, it's really about scaling horizontally - to that end, Rails and Ruby haven't been stumbling blocks, compared to any other language or framework. The performance boosts associated with a "faster" language would give us a 10-20% improvement; but, thanks to architectural changes that Ruby and Rails happily accommodated, Twitter is 10,000% faster than it was in January.
Twitter's explosion of growth in March certainly created pain points for them (gotta love slide 7 here) and a lot of lessons learned; but, it's not an indication that the framework inherently won't scale. Our belief is that when building a web app, agility is more important that built-in scalability. "Premature optimization" causes more problems than it prevents. Focus on building a site that people will really use, then refactor and optimize over time as your audience grows. Rails is made for agility. You always hear about development speed, but test-driven development is easier and faster in Rails as well. Both factors mean that making architecture improvements to an already-deployed site is more practical. Regardless of technology, build with scaling in mind, not necessarily built-in. Friendster didn't scale, but that seemed to be a management decision. Had Twitter obsessed about trying to build for the number of users it's supporting today, they probably never would have made it out of the gates. And then how would I possibly know that Darth Vader just ate a burrito?