Twitter's switch to Java kept the fail whale at bay

Nov 8, 2012 09:36 GMT  ·  By

One of the most surprising things about Twitter's US election coverage wasn't the volume of tweets, or the interest, or the immediateness of the responses, or even the fact that Obama's photo tweet broke all records as most retweeted ever. The most surprising thing was that Twitter worked through all of this.

Granted, Twitter isn't as fail whale happy as it used to be only a few short years ago, but it hasn't gotten a reputation as rock solid just yet.

But that may change – Twitter is boasting that, even though it's seeing bigger traffic than ever and, more importantly, for much longer periods of time, the service performed perfectly.

This, to the dismay of fanboys everywhere, was largely due to Ruby or rather, to avoiding Ruby. Ruby has had a loyal following for quite a while and the people who use it feel a bit more special than the other plain old boring programmers.

And it doesn't get any more boring than Java. Twitter's programmers aren't immune to this, which is why a lot of the backend is written in Ruby.

But it was Java that saved the day, Twitter has switched to a Java backend to service all requests from mobile apps, which make up a big chunk of Twitter traffic.

This, along with continuous optimizations to the Ruby stack meant that Twitter survived the election night, which saw 31 million election-themed tweets, close to 10,000 tweets per second for over an hour and a peak of almost 875,000 tweets in a minute.

As Twitter explains, it was used to seeing traffic peaks at certain moments. Previously, Twitter posted about tweets per second records, during New Year's Even in 2010, Beyonce's pregnancy, which saw 8,868 TPS and other such events.

But these peaks lasted for minutes at best. Now, Twitter is seeing traffic that is above the records set a year ago for hours at a time and it needs the infrastructure to handle it.