Should anyone ask, Twitter can’t blame Ruby on Rails

Twitter has been having scalability problems. No surprise. Their architecture is based around pumping all data into a DB and then polling the DB. This is nuts. They are asking a DB to act like a router, something that it is pretty bad at doing. Putting a DB into the flow IS THE PROBLEM. It’s not the language, it’s not politics, it’s not even about friendships or past contributions to a community.

Remove the DB and rewrite, using a messaging protocol like XMPP. Send the messages directly to the correct nodes or clients and *only* if the nodes are off-line, store in a DB.

There is an O(n^n) problem here when users send messages to every other user through a database. If you replace that with the idea of subscriptions and use a decent messaging protocol, the problem goes away.

Relational databases are not the solution to all problems. And if necessary stick with Ruby for the presentation layer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.