Adam Bien's Weblog

Thursday Apr 07, 2011

Ruby on Rails Was Supposed To Kill Java... Now Twitter Kills Rails

...Last week, we launched a replacement for our Ruby-on-Rails front-end: a Java server we call Blender. We are pleased to announce that this change has produced a 3x drop in search latencies and will enable us to rapidly iterate on search features in the coming months...

...To ensure a high quality of service while introducing Blender into our system (=twitter.com), we are using the old Ruby on Rails front-end servers as proxies for routing thrift requests to our Blender cluster. Using the old front-end servers as proxies allows us to provide a consistent user experience while making significant changes to the underlying technology. In the next phase of our deploy, we will eliminate Ruby on Rails entirely, connecting users directly to Blender and potentially reducing latencies even further... -@twittersearch

From http://engineering.twitter.com/2011/04/twitter-search-is-now-3x-faster_1656.html

Btw. I do not believe, that Java (EE) will kill Ruby on Rails either. Just use the right tool for the job (and Java for highly scalable apps)...


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Comments:

Now that confuses me. I thought Twitter switched to JVM/Scala way back?

Posted by zilti on April 07, 2011 at 07:13 PM CEST #

Partially - it seems like they switching completely from rails to java now.

Enjoy Java! :-)

adam

Posted by adam-bien.com on April 07, 2011 at 08:02 PM CEST #

I think you conveniently missed the words "from the search stack" when you quoted from the twitter blog.

In the next phase of our deploy, we will eliminate Ruby on Rails entirely <b>from the search stack</b>, connecting users directly to Blender and potentially reducing latencies even further.

It doesn't mean twitter is ditching RoR completely. At the same time, a lot of components are moving away from RoR to java/scala.

Posted by Alosh Bennett on April 08, 2011 at 12:16 PM CEST #

You could be a journalist with that selective use of bold and ellipsis ...

Posted by Stephen Souness on April 08, 2011 at 02:17 PM CEST #

@Alosh,

I just copied both paragraphs - I could copy more - but I would not like to change them.

I think the URL http://engineering.twitter.com/2011/04/twitter-search-is-now-3x-faster_1656.html

should be obvious...

adam

Posted by adam-bien.com on April 08, 2011 at 05:51 PM CEST #

private static final ArrayList<Integer> REFUNDABLE_TRANSACTION_STATE_IDS = new ArrayList<Integer>(Arrays.asList(new Integer[]{2, 6, 8, 12}));

Posted by private static final ArrayList REFUNDABLE_TRANSACTION_STATE_IDS = new ArrayList (Arrays.asList(new Integer[]{2, 6, 8, 12})); on April 08, 2011 at 06:48 PM CEST #

The first compilable comment ever :-)

Posted by adam-bien.com on April 09, 2011 at 12:50 AM CEST #

@Alosh,

"I think you conveniently missed the words "from the search stack"

I didn't quoter anything - it was twitterfeed...

"It doesn't mean twitter is ditching RoR completely. At the same time, a lot of components are moving away from RoR to java/scala."

No probably not. But it seems like twitter is moving away from RoR for the more critical parts of the system...

Posted by 192.168.0.32 on April 09, 2011 at 12:53 AM CEST #

@Stephen,

"You could be a journalist with that selective use of bold and ellipsis ..."

If Java becomes boring to me and the "thrill is gone" who knows what happens. :-)

Posted by 192.168.0.32 on April 09, 2011 at 12:54 AM CEST #

I call your ...
private static final ArrayList<Integer> REFUNDABLE_TRANSACTION_STATE_IDS = new ArrayList<Integer>(Arrays.asList(new Integer[]{2, 6, 8, 12}));

... and raise with ...

private static final List<Integer> = Collections.unmodifiableList(Arrays.asList(new Integer[]{2, 6, 8, 12}));

Posted by Morten Hattesen on April 09, 2011 at 03:00 AM CEST #

Correction (why aren't posts editable?):

private static final List<Integer> REFUNDABLE_TRANSACTION_STATE_IDS = Collections.unmodifiableList(Arrays.asList(new Integer[]{2, 6, 8, 12}));

Posted by Morten Hattesen on April 09, 2011 at 03:02 AM CEST #

I'll see all your code and raise you a Guava version:

private static final List<Integer> REFUNDABLE_TRANSACTION_STATE_IDS = ImmutableList.of(2, 6, 7, 12);

Posted by Mark Derricutt on April 09, 2011 at 07:19 AM CEST #

Write out 100 times:
I will not join this geeky thread about compilable immutable lists.
I will not join this geeky thread about compilable immutable lists.
I will not join this geeky thread about compilable immutable lists.
...
*ARRRGH* Here comes the Clojure version:

'(2 6 8 12)

Just too short to be refundable.

;)

Posted by Gerald Struck on April 09, 2011 at 04:47 PM CEST #

val IDS=List(2,6,7,12) ?

Posted by Someone on April 11, 2011 at 08:21 AM CEST #

i never heard that rails as a framework has started to kill java as a language/platform.
sounds very stupid to me if someone starts talking about that something is killing something else if both things cannot easily be compared with each other.

Posted by sam on April 11, 2011 at 10:46 AM CEST #

I am with Alosh on this one. Omitting the "from the search stack" is highly misleading. Dont spread false information. Please correct the quote.

Posted by Foobar on April 11, 2011 at 12:30 PM CEST #

@Sam,

I heard it all the time in 2006. Just google for that. My opinion is: "...Btw. I do not believe, that Java (EE) will kill Ruby on Rails either. Just use the right tool for the job (and Java for highly scalable apps)..."

thanks!,

adam

Posted by Adam Bien on April 11, 2011 at 12:54 PM CEST #

@Foobar,

I didn't removed anything from the quote. It was 1:1 copied from twitter blog...

thanks!,

adam

Posted by Adam Bien on April 11, 2011 at 12:56 PM CEST #

After moving their API to scala in the JVM, from Rails, they're now moving their search to java. Only the web site remains a RoR app. Bad news for those who keep seeing Java as the new Cobol.

Posted by Sam K on April 11, 2011 at 01:57 PM CEST #

Rails wasn't inveted to kill Java - it was invented because coding productivity with Java sucks. Ruby never stated to be faster than Java.

Posted by Christian on April 11, 2011 at 02:37 PM CEST #

[2, 6, 8, 12].freeze
?

Posted by ohaleck on April 11, 2011 at 02:48 PM CEST #

Reading through the original blog in a bit more depth, the problems they were having probably weren't insurmountable in Ruby/Rails. However, they have a lot of other stuff on Netty (the base framework for Blender) so it made more sense to solve the issues with that instead.

Posted by David Workman on April 11, 2011 at 02:52 PM CEST #

@Christian,

"Rails wasn't invented to kill Java"

You are absolutely right. But it was the common opinion back in 2006.

Even last year "Java is Dead" was a common scheme in the blogosphere :-)

Posted by Adam Bien on April 11, 2011 at 03:52 PM CEST #

Twitter would have never become what it is today, had it started based on the Java stack. The agility of RoR allowed them to grow at that pace. Sure, at some point other technologies are more efficient, but you would not wanna start with a truck if you had the chance to race around the beach using a sand buggy.

Posted by Sakuraba on April 11, 2011 at 04:23 PM CEST #

@Sakuraba,

do you think that twitter's functionality is too complex to be prototyped with Java?

Posted by Adam Bien on April 11, 2011 at 04:41 PM CEST #

@Adam

That depends on whether you take only the features or the load that twitter runs under into account.

It is not about complex, but about developer usability. The Java-world lacks in that area and it does not get solved by simply adding more annotations to the JEE standard. It is about not offending people with crappy APIs, long startup times, lack of zero turnaround features, NIH-syndrom, etc. It is not only about RoR, but the usual pleasure it is to work with non-Java tools. For example, compare the boilerplate of attributed m2m-relationships within JPA, the crappy association management code to the much nicer ORMs that have been developed in non-Java environments.

Instead of asking "What is necessary to possibly map any legacy database to some Java code, how ugly and complex it may look", the question is "What is the most straightforward, most obvious, simple way to do X". It is a mindset that creates self-imposed complexity which in turn wastes brain-cycles that could be used elsewhere, which is especially important in startup-environments.

Posted by Sakuraba on April 12, 2011 at 03:51 PM CEST #

@Sakuraba,

we should deliver a RoR vs. Java EE 6 shootout at a JUG / RUG (Rails User Groups :-)) then. Title: Prototyping Twitter with Java EE and Rails.

You should be then significantly faster with RoR, than I with Java EE.

Agreed?

enjoy hacking!,

adam

Posted by Adam Bien on April 12, 2011 at 04:35 PM CEST #

This wouldnt be representative. In reality it is not about expert in A vs expert in B, but rather average-developer in A vs average-developer in B.

Posted by Sakuraba on April 12, 2011 at 07:54 PM CEST #

@Sakuraba

I've found that many average developers are quickly able to get productive with Java EE 6.

Most of the APIs are very streamlined, logical and easy to grasp. Startup time with Glassfish is also very good.

EJBs in 3.1 in particular are very easy to use and at the same time very powerful. It's really easy to do some asynchronous operation or creating some periodic task. Much simpler than using a lot of other APIs.

JSF 2.0 is very streamlined as well, and I notice those average developers are able to get up to speed with it in mere days. Thanks to the rich components available and the simple ability to bind them to your backing code this really is a breeze.

Not everything is perfect though (but then again, what is?). JBoss AS has a rather long startup time compared to Glassfish and there is some confusion for beginners between JSF @ManagedBean, CDI @Named and EJB @Stateless.

JPA is very simple to use for retrieving simple entities, but when it concerns object graphs beginners or average developers too often create code that does dozens of queries (because they don't understand lazy loading). Also, implementation wise JPA could see some improvements. Senseless multiple bags exceptions occur just too often in e.g. Hibernate and because of bugs in Hibernate things that should be possible according to the spec in practice just aren't possible.

All in all I would say that Java EE 6 is a *very* serious contender for productivity for average developers. If they can align the different kinds of managed beans and make it a little more straightforward to prevent the dozens of queries that JPA generates it will be truly one of the best out there ;)

Posted by Robert Tuinman on April 12, 2011 at 10:50 PM CEST #

But let be fair: Rails still can "kill" Java running on JRuby (which is faster)... :-)

Posted by Bo Maryniuk on July 14, 2011 at 09:30 PM CEST #

The title should be "Ruby Has Killed Java... Now Scala Kills Ruby"

Posted by NingYu on December 16, 2011 at 08:48 AM CET #

@NingYu,

is there are Matz Distortion field?

Something what is #1 just cannot be dead: http://www.adam-bien.com/roller/abien/entry/java_is_1_in_opensource

thanks for your interesting point of view!,

adam

Posted by Adam Bien on December 17, 2011 at 05:01 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License