I am a huge fan of Ruby on Rails, but I was not terribly surprised to read that as Twitter’s code base has grown, they’ve found it more amenable to move to JVM-based languages for reasons having mostly to do with encapsulation. InfoQ interviews Twitter engineer Evan Weaver about how the company’s stack is evolving as they get bigger.
On one hand, they’re moving more services to the JVM for performance reasons. When they extract components from their main code base to optimize them, they generally migrate them to the JVM:
The primary driver is honestly encapsulation, so we can iterate faster as a company. Having a single, monolithic application codebase is not amenable to quick movement on a per-team basis. So when we decide to encapsulate something, then because of our performance concerns, its better to rewrite it in the JVM for most systems, than to write a new Ruby system.
They’re also finding the rigidity of the JVM useful for productivity reasons:
And the other half is that, as search has moved into a Service Oriented Architecture and exposes various APIs, static typing becomes a big convenience in enforcing coherency across all the systems. You can guarantee that your dataflow is more or less going to work, and focus on the functional aspects.
Those are the kinds of reasons why I could not imagine rewriting the main application I work on as a Ruby on Rails application. I’m surprised he doesn’t also mention the maturity and power of the tools on the Java side. Text editors like TextMate and Vim are great, but when it comes to navigating through a large, complex code base, you cannot beat the state of the art Java IDEs like Eclipse and IDEA.
Update: Edd Dumbill lists seven reasons you should use Java again.
July 7, 2011 at 9:37 am
July 7, 2011 at 2:07 pm
Twitter hired a bunch of JVM engineers some time ago. Obviously, they find Java more comfortable than Ruby.
Again, they are using SOA (which I assume is being implemented with SOAP or equivalent). SOAP and Java are a good pair.
OTOH, if they had been using simple named parameters and message passing, I suspect it would have been easier to stick with Ruby.
Patrick, ack http://www.betterthangrep.com/
July 7, 2011 at 3:31 pm
SOAP?????? Please god no. I seriously doubt they or any other successful company is using SOAP for new code.
JSON + REST, sure.
July 8, 2011 at 3:31 pm
Java? Afaik they switched to Scala?
July 8, 2011 at 6:29 pm
The link to the InfoQ interview is: http://www.infoq.com/articles/twitter-java-use
July 8, 2011 at 7:04 pm
They use Thrift, not JSON + REST or SOAP.
July 8, 2011 at 7:39 pm
Twitter is using a wide range of technologies to achieve whatever tool they need at various levels of their stack. Moving from a high velocity of market entry and definition to strong long lasting stability and mass marketing. If you’d like to pick out your personal attraction within that stack go ahead, you are largely missing the point.
Put away the measuring tape…