Twitter is famous for its use of Ruby on Rails, but as it has scaled the service up it has migrated some of its code to other technologies. The company began by migrating its back-end message queue to Scala (which runs on the Java Virtual Machine), continued by rebuilding its back-end search in Java and most recently replaced its search front-end with a Java server.
InfoQ is running an interview with Twitter engineer Evan Weaver who explains more about the shift.
Here are a few interesting points:
- In general, developers at Twitter from a Ruby background prefer Scala, and those with a C/C++ background prefer Java.
- The search team uses Lucene and is experienced in Java. Java is more convenient for them than Scala or Ruby.
- Twitter uses a library called Finagle for building asynchronous RPC servers and clients in Java, Scala or any JVM langauge.
- The move to Scala and Java at Twitter is driven more by a need for encapsulation than for performance and scalability and much of the existing Ruby code is quite workable for the time being.
- Static typing has been a productivity boon as Twitter search has moved towards a service oriented architecture.
The interview also goes into more specific technical reasons for preferring Scala to Rails, such as better vertical integration. Weaver also talks about Twitter’s overall architecture, which was described in the talk we covered here.