twitterがrubyからscalaへスイッチ

twitterが2007年後半に先進的なユーザーに急速に受け入れられて以後、そのruby on railsアーキテクチャーはたびたびトラブルに見舞われてきた。しかし2008年中盤にtwitterがこっそり一部コードをscalaにポートして以来トラブルはなくなった。Twitterの開発者であるAlex Payneによれば普通に考えられているRuby on RailsPHPPythonなどいわゆるアジャイルな言語はすばやい変化に対応するには見合っているが非同期的プロセスのような力仕事には、スイス連邦工科大学ローザンヌ校のマーティン・オダースキーMartin Oderskyにより開発されたscalaが合っているという。2007年のある時点でtwitterにおけるrubyベースのメッセージ・キュー・システムが増えるプロセスに対応できずに壁にぶちあたったことに気付いた。2008年中盤にはメッセージ・キュー・システムは完全にクラッシュし、復旧に2時間半かかることになってしまった。マイクロブロギングの世界において2時間半は永遠とも思える時間だ。scalaであれば同量のバックログを復旧するのにかかる時間は20秒で足りるという。scalaによる新システムはオバマ大統領就任式前の08年終わりには準備を終えていた。また今年終わりまでにはすべてのミドルウェアAPIにおいてscalaへのスイッチを済ませる予定で、rubyはユーザーが直接眼にするフロントエンドで使われ続けることになる。

Sometime in 2007, Twitter came to the realization that its Ruby-based message queuing system couldn't keep up with all that Web2.0rhea. "It grew with us for a number of months, and then, at a certain point, it just hit a wall," Payne said. "And that wall was not so much it code but in limitations in Ruby virtual machine. There's a lot of things that Ruby is great at, but long running processes? Particularly memory intensive ones? Not so much." By mid-2008, one of these Ruby message queues completely crashed and developers needed two and a half hours to shove the dropped Tweets back through the system. When your game is micro-blogging, that's a lifetime. Then, in his spare time, one developer ported the code to Scala. According to Payne, the Scala queue could process the same message backlog in 20 seconds. The new system was in place before the end of last year, Payne told The Reg, just in time for the Twittering chaos of the Barack Obama's inauguration. By the end of this year, Payne said, Twitter hopes to have its entire middleware infrastructure and its APIs ported to the new language. Ruby will remain, but only on the front end. "We're still happy with Rails for building user facing features... performance-wise, it's fine for people clicking around web pages. It's the heavy lifting, asynchronous processing type of stuff that we've moved away from."

http://www.theregister.co.uk/2009/04/01/twitter_on_scala/