
Twitter jilts Ruby for Scala - astrec
http://www.theregister.co.uk/2009/04/01/twitter_on_scala/
======
zmimon
The very title of this article shows the religious nature of much of the hype
around dynamic languages. Why is using the right tool for the job "jilting"
another language which was never designed or meant to be suitable for the same
job?

I am curious though whether they tried running their Ruby code using JRuby ...
if the bottlenecks were (as stated in the article) in the ruby VM they might
have got the same result just by switching VMs (pure speculation).

And ...

> "The biggest selling point for certain organizations is that Scala is 100
> per cent compatible with your existing JVM code.

No, it's not. There are problems with quite important features like
annotations etc. which are now very important in the java EE space but Scala
cannot do them. This was one reason I've used Groovy so far in a lot of
situations.

Having said that - I'm seriously looking at Scala because groovy has plenty of
faults: the complete lack of any static type checking at compile time and very
poor IDE support and error reporting all weigh down on the productivity
benefits to the point where it's sometimes a net negative. Scala could end up
being the best of all worlds.

~~~
michaelneale
>Why is using the right tool for the job "jilting" another language which was
never designed or meant to be suitable for the same job?

That would be a question for the journalist who made it up ;) I am sure the
answer was "cause it sounded cool !".

~~~
jhancock
that's pretty much how "the Reg" operates.

Without regard to the tone of the article though, Scala and Lift are worth
spending some time with.

Lift still has a ways to go in terms of providing a turnkey stack in the same
vein as a Rails or Merb stack. If you thought putting together a Ruby dev
environment had a lot of pieces, get ready for Lift...not so much Lift's fault
as its the nature of the heavyweight JVM toolset world.

~~~
michaelneale
I love scala, as a language, and love rails, as a framework which doesn't make
me thing to much - I can see how twitter would like the combo too. Even with
the toolchain annoyances I think scala is pretty productive, at least it is
for me.

------
oomkiller
I think anyone who has any depth of experience with Ruby can attest to the
flaws it has data-intensive tasks. Thats why many of us just drop down into
another language when we need to get something done efficiently. Ruby's
clarity and conciseness make a lot of sense when writing views, controllers,
and models, but don't have the same effectiveness in a background process that
needs to be written and forgotten about.

Unless there are some major changes in Ruby (MORE than 1.9), I believe that it
will be relegated to simple web applications, and never really be good at
processing tons of data.

And honestly, isn't Ruby really just about prototyping? I admit, its great for
startups who have nil for cash that need to get something written QUICK (to
get money from investors), but once you cross that threshold, why not write it
over with a language designed for efficiency?

~~~
ashot
I'm not a ruby dev, but could you be more specific? Assuming you are refering
to syntax, not speed: how is it good for prototyping but not "data-intensive
tasks"

~~~
emmett
All of the Ruby runtimes are unreliable (buggy) and very slow. Ruby syntax is
perfectly good for "data-intensive tasks", but the current runtimes are not.

~~~
ewjordan
How does JRuby's implementation compare to Scala's, though? I've been pleased
overall with Scala, but I've not had much JRuby experience, so I'm curious.

~~~
fizx
JRuby's a pretty solid implementation. It's generally faster than MRI 1.8.x,
and has the benefit of quality threading. I think Scala is probably ahead,
because Scala has the benefit of being-more Java-like than JRuby, and is
therefore easier to implement.

For my serious apps, I typically write the front end in JRuby on Rails, and
migrate code back into Java as it stabilizes and/or needs more performance.
Works great for me!

~~~
jshen
I'm doing this at my current job as well. Jruby is great!

------
jpcx01
Seems like a perfectly reasonable approach. They still are going to continue
using Ruby on the front end of the site. It's just the backend message
queuing, and data operational stuff that they're moving to Scala.

I probably would have just used JRuby for this stuff, but Scala seems fine to
me. And if it works for them, thats great. But I hardly see this a "jilt"
against Ruby.

~~~
dkarl
JRuby is what, a few times faster than Ruby 1.8.x? In a situation where Ruby
was too slow, even after optimization by experienced Ruby coders, I don't see
how switching to JRuby would have helped. Is there a crucial performance
difference (threading maybe, or libraries) that would have made JRuby scale
better than Ruby in this case?

~~~
jpedrosa
I use JRuby to run a web application that I first coded in Ruby and it works
pretty well even though it reserves and consumes more memory. Having a
dedicated server for JRuby applications instead of running such applications
on your own desktop alongside other applications slightly helps with the
feeling of speed of the JRuby application, as it does not compete for CPU time
with the other desktop applications you have like the browser, when you can
feel that JRuby requires more work than Ruby for doing similar workloads. :-)

I know that the pros of JRuby for running Ruby applications mean things like
being able to run multiple instances of Ruby from the same process, being able
to run JRuby applications in a standard Java web-server be it as Servlet or a
more high-level installation, and so on.

Also, Java has had a lot experience in running server applications so Java
does help with maximizing the use of the resources available, be it 100% of
CPU time, gigs of memory, multiple CPUs, and so on. Java has those famous
garbage collectors and HotSpot technologies. JRuby can enjoy all of that so it
does improve things over pure Ruby. Let's say, Java doesn't break a sweat
under heavy load, or at least it shouldn't. Whereas with pure Ruby all bets
are off.

------
nessence
"And he's pitching his new Scala book. And his new Scala book is published by
O'Reilly. And O'Reilly runs the Web 2.0 Expo. ®"

Timing is priceless.

~~~
sachinag
So what? He likes Scala. Likes it enough to write a book in his spare time, of
which he has precious little since he's, oh yeah, _a full-time developer at
one of the biggest, fastest growing sites on the face of God's green earth_.

So it's a (mild) conflict-of-interest (really, it's just a promotional
opportunity). Doesn't make the arguments any less valid or his book any less
worth picking up. Nice thing about code is that it's like science - every
claim can be tested ad infinitum.

~~~
Semiapies
And if the Scala reworking goes poorly, he presumably suffers, too.

One idle thought: It'd be hard to eliminate the factor that they might be a
better Scala dev team than a Ruby dev team. That's still, of course, a
perfectly good reason to go to Scala.

------
intranation
This quote:

"The trouble, he insisted, is that the so-called Web 2.0 languages aren't
always as efficient as they need to be, especially in an economic environment
threatening to bring Web 2.0 to its knees."

Is particularly dire. Sure, so if we all switch to C or machine code we'll be
able to skip through the recession, right? Seriously, less drama and more
reporting please.

------
nir
Carpenter jilts saw for hammer

[EDIT: dear downmodders, the intention here is that languages are tools, and
you pick the one which fits your current needs best. What's good for Twitter
isn't necessarily best for another app, and Scala <=> Ruby is meaningless]

~~~
alecco
HN is getting lamer than ever with this downmodding of anybody who doesn't
conform. It would be interesting to know the overlap of opinion-based down-
modders and Reddit/Digg bashers.

------
jseifer
"Investors now want to know that you're not going to be paying tons and tons
of money for servers because you decided to build in a stack that isn't as
efficient as possible," he said.

I've never used Scala and I'm a Ruby dev but I'm still not sure I totally
agree with that. Scala is probably great and very efficient but you probably
don't need to be thinking at Twitter's level out of the gate.

~~~
tptacek
It's also the case that headcount is far more expensive than servers.

~~~
Tichy
Still, I worry that despite Ruby's niceness, a lot of time is spent developing
around it's issues. Whenever I read about deploying Ruby, it just sounds
scary. Memory munching Mongrels that have to be restarted on a regular basis?
It sounds like a science in itself, whereas tomcat just runs and runs and
runs. Less headaches == less headcount.

~~~
rcoder
If you know and like Tomcat, may I suggest you have a look at JRuby deployment
for Rails apps? With recent versions of jruby-rack and the warbler gem, it's
as simple as listing your dependencies in a config file, and then running
'rake war' from the top level of a Rails app to get a shiny new WAR file ready
to drop into your Tomcat deployment directory.

------
petercooper
And in case you're wondering.. no, this isn't an April Fools joke.

~~~
tptacek
In this case, it'd've been a joke cued up several months ago, when this story
first broke.

------
dpnewman
I think it's important to remember that Twitter had this problem because they
were ULTRA successful to the degree of being a household name, a new cultural
lingo, a game changing tech of enormous value, etc.

Yes, different languages and techs for different advantages and purposes.

"Just" developing a web app with models and views and controllers is enough to
create the user experience smash hits are made off. Scaling issues are big,
but certainly fall in the class of problems we want to have at some point.

~~~
antirez
> Scaling issues are big, but certainly fall in the class of problems we want
> to have at some point.

Well actually with a big of good design from start you may avoid this problem
from the start with little efforts. You'll have to scale anyway but it will be
a matter of buying more hardware and not redesigning the system.

------
cosmo7
Although the Reg sensationalizes the story, it's interesting to see how Ruby
is in limbo. How much damage has been done to Merb by the 1.8 to 1.9 fiasco?

~~~
jpedrosa
I agree that the Ruby 1.8 to 1.9 transition has caused headaches. But the 1.9
version does have some interesting features that have been long being cooked
to get to this point, and perhaps more interesting is that the 1.9 version has
motivated even more developments in Ruby-land as found in MacRuby that uses
the 1.9 version or in yarv2llvm that recompiles the bytecode to llvm or
something.

Let's say that many folks might have had higher expectations that have been
hard to meet given the reality of it all.

The Merb guys helped with further explorations themselves which probably
helped with making Rails advance more decisively, given the promissed
"merging" of the Merb ideals with Rails.

Also, with things like Passenger, the deployment of Ruby met an all-time high
in features.

------
antirez
I don't understand a lot this approach. Basically the front-end is almost
always not the problem, but the Db / backend is. And this should be written in
C probably. If you write a queue system in Ruby and it's slow where is the
news?

The article title is misleading since Ruby continues to be used for its core
business that is the front end.

------
donal
Sheesh, from the comments you'd think The Register is known for level-headed
journalism.

It is a snarky, piss-taking, grease-trap that mixes news with commentary with
little to no discretion or fear of violating "journalistic integrity." Once
you understand that, it becomes a great source of news and entertainment.

~~~
jrockway
_Once you understand that, it becomes a great source of news and
entertainment._

Or rather, a great site to ignore.

------
Semiapies
Following Twitter's issue blog, most of their problems appear database-
related. I wonder whether a shift to Scala would have any real effect.

~~~
cosmo7
Threading.

~~~
Semiapies
Hmm, I could see that. I just wonder how many of their problems actually come
down to thread issues.

May just have to wait and see whether their new "beautiful code" does any
better. :)

------
awt
it seems that the article ignores the trade off in cost between efficient code
and development time.

~~~
jimbokun
Scala tries to be pretty good at both. Java like speeds, with type-
inferencing, first class functions, and a more flexible syntax to improve
programming productivity.

------
c00p3r
That is so funny to choice JVM-based stuff is case when you need an
accept/select/read/write hardcore (message passing) along with queue
processing. Of course, you can do networking from JVM, and it works well in
clean cisco-branded qos-enabled networks. =)

If one had had an experience of using java-based network tools over cellular
or wireless networks, one knows.

At the same time, Erlang is around for a decade.

------
alecco
Unfounded claims, no research, nothing. After years of suffering websites
running on JVM web stacks, I am very sceptic of this Scala for the web rant.
Plus he extrapolates Ruby to Python and PHP just because. The JVMs (there are
several) mostly trade-off memory for speed. Go check the Language Shootout
page. It doesn't scale in my book.

So unless Scala has some secret ingredient to use the JVM more efficiently,
this looks to me as yet another fanboy rant.

~~~
rcoder
First of all, I don't think it's fair to accuse the Twitter dev team of
working without real experience and numbers to back up their decisions. They
have a huge volume of data being generated by their service, and have
weathered the whole "Rails doesn't scale" flame-fest with relative grace and
good humor. IMHO, that entitles them to talk fairly freely about the relative
scalability of different languages and frameworks.

Secondly, any "ranting" you hear in this article is the product of El Reg, not
Alex. He mostly offered a calm, positive presentation about the improved speed
(with relatively little, if any, tradeoff in developer productivity) that came
from using Scala instead of Ruby for critical infrastructure services.

Regardless, most Java web applications' performance issues stem from
framework-itis, not from the underlying runtime. By itself, Tomcat (or another
modern Java servlet container) is capable of some pretty impressive throughput
-- perhaps not on par with a lean, pure C server like nginx, but not nearly as
limited in functionality and extensibility, either.

No matter what you think about Java the language, you at least have to admit
that HotSpot blows MRI, YARV, the Python VM, and Parrot out of the water when
it comes to raw performance on low-level code. That doesn't save you from bad
implementation ideas, but it does at least give you the _possibility_ of
getting fast, efficient code, if you have a decent compiler and work fairly
close to the metal.

Using Scala is one way to produce that sort of low-level implementation code
without wanting to gouge your eyes out (which is how most Java source tends to
make me feel, anyway).

~~~
alecco
No, the JVMs use memory like crazy themselves, it's not just the frameworks.
As I said, check out the Language Shootout. Java, in almost every test, is
several times bigger than most other languages.

The rest of your comment, you change what I said so it's not worth addressing.

------
jpedrosa
Seeing the April 1st date of the article it was just a little bit harder to
believe they would write it like that. As folks have taken it seriously...

The Ruby community was formed without being forced into it necessarily.
Academics did not force people into Ruby. Businesses did not force people into
Ruby. Even Ruby on Rails was created because DHH was not forced to use PHP and
instead tried to make things work in this new called Ruby.

Scala has its followers but Academics push it and business types can push it
as well even though many business types still prefer Java and C#. Also, Scala
is being primarily used for server-side stuff which is a very crowded market
already and many developers are just a little bit too tired of having to
interface with complex server-side stuff while trying to innovate on the
client-side.

Thing is, as a guy who really digs Ruby, Scala does not worry me one bit. I
could always try and use a hyper-advanced Scala implementation or application
in the future given I can make choices at one point and then have to revisit
said choices in the future given the changes brought by new developments.

Let me tell you a little story. When C# was being first introduced in its very
early versions, I was very much playing Ultima Online on pirate servers. A new
pirate server was being coded in C# and it was becoming rather popular quite
fast and the single developer (or was it?) was having quite a lot of fun with
it. Nobody told him to use C# for that kind of thing I am sure, it was just
him putting his passion forward with the means he had at the time. C# has
grown since then, and many pros and hobbyists use it to create all kinds of
little programs on Windows.

Scala? Scala has an uphill battle, and many other languages have had their own
uphill battles throughout the years. It's tough.

~~~
jrockway
Uh, who cares?

Some day you will realize that programming languages are tools for getting
work done, not religions.

