Tweet Relief —

How did Twitter handle election tweets? Less Ruby, more Java

As Twitter continues to tweak Ruby performance, it moves more to JVM on servers.

On Election Day, as Donald Trump raged on Twitter about revolution, Nate Silver took an opportunity to pitch his book, and an 18-year old girl vowed to move to Australia "because their president is a Christian and actually supports what he says," Twitter's servers were handling a surge of 327,452 "tweets" per minute, according to Mazen Rawashdeh, Twitter's VP of Infrastructure Operations Engineering. In total, there were 31 million "election-related" posts to Twitter over the course of the day, and the traffic continued to periodically spike—at one point reaching 15,107 tweets per second.

Part of the reason Twitter was able to sustain the unprecedented continuous spikes in traffic, Rawashdeh said in Twitter's engineering blog, was a set of changes the company's operations team has been making over the past year in Twitter's infrastructure—including a move away from the Ruby web scripting language and runtime engine that Twitter was built on, and toward code (a combination of Ruby, Java and Scala code) running on a server-side Java Virtual Machine , while at the same time continuing to tweak Ruby's runtime for more performance.

Twitter has largely run on a modified version of Ruby, called Ruby Enterprise Edition, since 2009. But the interpreter for Ruby has put heavy loads on the processors of Twitter's servers, partially because of its "garbage collection"—the task of reclaiming memory from processes that have ended. Twitter's developers have continued to try to optimize Ruby's garbage collection to squeeze more performance out of the runtime, developing their own garbage collector called Kiji. But the company has also begun to move its development efforts away from Ruby and onto Java.

"As part of our ongoing migration away from Ruby," Rawashdeh said, "we’ve reconfigured the service so traffic from our mobile clients hits the Java Virtual Machine (JVM) stack, avoiding the Ruby stack altogether."

Channel Ars Technica