Performance of Java vs. Ruby


The Twitter Engineering team (@twittereng) has just achieved an impressive 3x performance improvement for Twitter search queries, largely, it seems, by replacing Ruby-on-Rails web applications with new applications built on Java, coupled with a switch from MySQL to Lucene for the data store (we blogged on the NoSQL phenomenon recently).

The main differences at a low level between the Ruby implementation and the Java one hinge on synchronous vs. asynchronous request processing, avoiding I/O and network waits, which frees up front-end worker threads to do the job they do best: serve HTML and RSS.

Their custom Blender Java server uses Apache Thrift and the lightweight network I/O server Netty to help aggregate result data, thereby avoiding the overhead associated with HTTP-based service calls and reducing the query load on the database.

Leave a Comment

(required)