Twitter move to Java

Michal Fojtik mfojtik at redhat.com
Fri Nov 16 14:28:18 UTC 2012


On Nov 16, 2012, at 3:02 PM, Dmitri Dolguikh <dmitri at redhat.com> wrote:

Interesting. We had a great session with Charles Nutter (jruby contrib) last
night, discussing various issues that MRI has with garbage collecting.
My personal impression is that jRuby rocks when it come to long running
processes (or web applications). JVM can actually handle GC and memory a way
better than MRI do.

So I did a quick test yesterday night (or today morning ;-) where I tried
to use TorqueBox to run Deltacloud API and then do a benchmark using 'ab'
command (1000 request, concurrency set to 5) and I got interesting results:

1. Deltacloud API works like a charm on jRuby (no problem, no exceptions, ...)
2. The performance is 2x better with jRuby than using MRI
3. Using MRI with 'thin' reveals that 5% of requests just failed without any reason,
   where using jRuby all request were served properly.
4. The memory used by both are almost the same (well JVM use a bit more memory, but
   at least it does not grow ;-)

There are two drawbacks that I observed:

1. The boot time of JVM (jRuby) is a bit longer than MRI - but that is not an issue.
2. There is no code reloader for Sinatra in Torquebox (at least I tried to find one
   but no luck)

So to wrap this up, I'm very surprised by the jRuby performance and also by compatibility
between MRI and jRuby (1.7.0).

If you want to try it out and you use rvm or rbenv, it is easy to install jruby (1.7.0).
Then after you install it and enable it, just install 'gem install torquebox-server' (100MB ;)
and in 'server' dir just run:

$ torquebox deploy
$ torquebox run

You don't need to modify anything, DC will be spawn on port 8080 (not 3001). Also TorqueBox
include many features from EAP, like background jobs, messaging, caches, etc.

  -- Michal

> On 16/11/12 01:45 PM, Giulio Fidente wrote:
>> On 11/16/2012 01:57 PM, Martyn Taylor wrote:
>>> Worryingly...
>>> 
>>> http://www.theregister.co.uk/2012/11/08/twitter_epic_traffic_saved_by_java/
>>> 
>>> Let's all not jump ship just yet!
>> Now, not to start any war on programming languages but I always tought
>> that the JVM was faster [1] (for cpu bound and memory bound tasks)
>> mainly because has got strong and static typing.
>> 
>> But is it just that?
>> 
>> [1]
>> http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/
> JVM is pretty great. Note that Twitter projects are not using Java however, but rather Scala (and clojure), neither of which outperforms Java. I think it's not really a testament to how fast Java is, but rather to how badly ruby VM sucks.
> 
> -d

Michal Fojtik
http://deltacloud.org
mfojtik at redhat.com






More information about the aeolus-devel mailing list