Bob, Kieran, Rowan,
Great articles and amazing statistics on Twitter; and the true nature
of scalability. Thank you all!
Below, I write some points that became evident after reading
Hueniverse.com; one of the best discussions I've read on this subject.
Whenever I quote, I am referring to Hueniverse part I here:
http://www.hueniverse.com/hueniverse/2008/03/on-scaling-a-mi.html
1. Twitter is Close to Real Time, No Framework or Language will have
an easy Run with it.
- Twitter is as close to real time messaging as it gets, that's their
challenge. Ruby on Rails is not really the issue, the issue would
apply to almost any language, even C. Since the bottlenecks are
potentially everywhere the hits come, go or bounce too.
A quote from Hueniverse: " Facebook offers users abstract controls
over what kind of content to show and then provides a feed that is an
approximation of what the actual accurate aggregated status really is.
What this means is that Facebook is showing a timeline that is good
enough but not fully reliable and in the context of a friends feed is
good enough. The same cannot really apply to Twitter or other
messaging platforms where reliable delivery of messages in order is
critical. "
2. Twitter is not Facebook, is not MySpace, it is about messaging
- Facebook gives you an approximation of what's going on, there can be
a significant lag in updates, same goes for MySpace, Flickr and almost
any other social network. Those delays help to scale. Twitter has no
such luxury.
- The problem is that for this over 10,000 request a second universe
of Twitter, a database IS NOT the solutions, and every bottleneck
becomes significant. Related:
http://www.mooseyard.com/Jens/2007/04/twitter-rails-hammers-and-11000-nails-per-second/
3. New Tools are Needed and They will be built... in the meantime:
It's the Architecture Stupid!
Tools like Merb, database Sharding, intelligent caching and more are
needed. None is perfect, none can solve the issue ahead. Even Twitter
has released Starling for queuing
http://rubyforge.org/projects/starling,
more is needed, more will come... but in the meantime architecture,
intelligent humans thinking is the only real solution to this
challenge.
The moral of the story would be: stop thinking the database is enough,
stop thinking the framework will do everything for you, stop and
architect early on for success, and big traffic or face the
consequences of your decisions.
For one, I still like Ruby on Rails, I will surely look into MERB now,
and also never I will never discount PHP; it seems that somehow PHP
developers have been able to scale that language beyond anyone's
expectations. Flickr is a good example:
http://highscalability.com/flickr-architecture;
so for the most part "scripting" languages seem not to be the real
culprit. And the benefits of scripting outweigh the cost of "not
compiled" here.
Or as Blaine Cook of Twitter said, quite accurately:
"For us, it’s really about scaling horizontally - to that end, Rails
and Ruby haven’t been stumbling blocks, compared to any other language
or framework. The performance boosts associated with a “faster”
language would give us a 10-20% improvement, but thanks to
architectural changes that Ruby and Rails happily accommodated,
Twitter is 10000% faster than it was in January."
http://highscalability.com/scaling-twitter-making-twitter-10000-percent-faster
Take care everyone,
Joseph Hurtado
Web Developer
Toronto, Canada
> <
http://highscalability.com/scaling-twitter-making-twitter-10000-perce...
> >
>
> I've extracted some of the stats from the 10000% article. It is
> worthwhile keeping in mind just what we are talking about.
>
> • Over 350,000 users. The actual numbers are as always, very super
> super top secret.
> • 600 requests per second.
> • Average 200-300 connections per second. Spiking to 800 connections
> per second.
> • MySQL handled 2,400 requests per second.
> • 180 Rails instances. Uses Mongrel as the "web" server.
> • 1 MySQL Server (one big 8 core box) and 1 slave. Slave is read only
> for statistics and reporting.
> • 30+ processes for handling odd jobs.
> • 8 Sun X4100s.
> • Process a request in 200 milliseconds in Rails.
> • Average time spent in the database is 50-100 milliseconds.
> • Over 16 GB of memcached.
>
> Cheers,
> Bob
>
>
>
> > Some more commentary on this issue:
> >
http://www.alexhopmann.com/2008/05/12/twitter-ruby-on-rails-and-scala...