How Twitter (and Facebook) solve problems partially

Exp growth data

Status updates and realtime search are very hard problems, especially with tons of data and million/billion of updates. If you think about status updates then they grow exponentially with a very small factor as the social graph grows. Exponential growth is a _big_ problem and would require tons of hardware to scale. But luckily there is a partial solution for this.

I will tell you a little secret on how to solve the problem with exponential growth. The secret is simple: you only solve 80% of the problem! Now that you know this secret, then look at how Twizzle and Facebook has implemented their status updates... If you are lazy then I can tell you: they keep their status update list fixed. So what does this mean? This means that for every user they have a fixed list of latest updates, this list follows First In, First Out principle.

Want a proof of this? Check out how many pages you can go back in your tweet feed:

The problem domain gets _a lot_ simpler with fixed lists and you can do some crazy optimizations, since the data footprint is very small.

Twizzle's realtime search

Dali time

Realtime search is also a big problem. One can read more about the challenges in this blog post:

How does Twitter (and Facebook) solve this problem? By limiting their data. Twitter can only search 2 months back in time! Want a proof?:

Right now Plurk solves this without cheating. Twizzle (and Facebook) solve this by solving the problem partially by reducing the data they search in.

Are these issues?

It depends. It's clear that the focus of Twitter search is to have recent results, so if you are looking for recent stuff, then you don't have an issue. It's clear that Twitter has again solved the problem partially by focusing on following:

  • at least 80% of Twitter searches are interested in recent stuff
  • 20% of Twitter searches might be searches that are interested in older stuff

By not solving the last 20% they simplify their problem a lot, but of course, they haven't solved the problem completely.

So what can you learn from this? Sometimes you don't have to solve the problem 100% to succeed... You can solve it for 80% of the use cases and still be successful.

22. Aug 2009 Code · Design · Plurk · Tips
© Amir Salihefendic