by ck2 · 15y ago · 0 comments
Doesn't WordPress.com do it with like a dozen people and their system is way, way, way more complex?
update: no, wait, in December 2010 they announced it's over 350 people now
http://blog.twitter.com/2010/12/stocking-stuffer.html
What on earth are they all doing?
Wordpress.com is trivial compared to Twitter.
http://thenextweb.com/twitter/2011/01/06/new-years-eve-set-a...
I don't believe Twitter is trivial, but I think they're perceived as more complex than they are - WordPress + Reddit + Heroku only have like 10% that number combined. Apples to oranges, but those 3 companies would be doing more everythings per second than Twitter when you combine them.
Twitter's fundamental problem also is a harder one to scale than something like Heroku or Wordpress. For those hosted sites, you can shard easily by host, so that each of the 100,000 Heroku-hosted sites can get its own EC2 instance(s) and behave pretty much independently. You can't do that when the point of your site is that any action might instantly be broadcast to thousands of followers. High-fanout writes are not an easy problem to solve.
------------------
Color me unimpressed.
At some point, I was collecting 40GB/day of financial data (and that's after bzip2ing them .. probably 200GB/day before); This was done on hardware costing $30K (which was two equivalent machines with 4GB, each having 20*1TB in a raid configuration -- this was a hot-backup configuration) and the operation run (coded, supervised, administered) by 2 people.
I'm extrapolating from your numbers: Let's say you have 70GB over 14 days = 5GB/day; Let's assume Twitter has 100GB/day of text twits (which, incidentally, means ~1 billion tweets per day which I highly doubt, as they took few years to get to the 1 billion mark, and last I heard they were at less than 100 million twits/day)
Then, at this day and age (numbers selected for 2 years ago, when they had their last infrastructure revision), what you do is buy 20 servers with 8GB of memory each (for, say $5K each), plus a little redundancy, and store all the latest twits in memory, and the most popular user's older twits as well; everything else on disk. Throw in cheap web front-ends that don't even need a local disk, load balancing, and a gigabit ethernet backplane. You're still under $200K in equipment.
Yes, the code is not going to be trivial, but for $100K and 3 months you can get a stunt programmer (I know a few who can do it and won't charge as much).
A run-of-the-mill RDBMS is the wrong tool for this job; Basically, run of the mill anything; but that does not make it incredibly hard.
I think $300K for hardware and software, you can get a Twitter clone that performs as well.
Twitter is successful, but that's not thanks to good engineering.
TLDR; It is not the vertices in the twitter graph but the number of edges in it that is unprecedented.
RSS strikes me as an almost identical process other than the time subscribers wait to check for new content, and there are feeds with millions of subscribers. So now the problem is reduced to doing it in a timely fashion.
This is why I wonder if they're really that immensely complicated - isn't Google doing much the same thing, and possibly even at a bigger scale at one point, with their reader and FeedBurner?
WordPress.com is not as trivial as you might think http://en.wordpress.com/stats/
Certainly it's just a matter of scaling once you hit a certain level of volume, you just have to be able to bring more servers online into the grid.
Scaling from 10,000 users to 1 million is probably very hard.
Scaling from 1 million to 100 million, well you better have a pattern down that works with easy hardware replication (like google does).
Jeff Dean's rule of thumb is that you should build a growth factor of 10 into the design, but any more than that and you will probably have to re-architect anyway. So going from 10,000 to 1 million and 1 million to 100 million are probably roughly equivalent in difficulty.
You will have to have something that deals with mapping URLs in the unified logical name space of your site to the individual servers that the particular blogs on--that's the part that you can't just throw machines at and get good results.
With the social sites, you can't isolate things easily, because what a given person sees at any time is drawn from an ever changing set of content from other users, with each viewer drawing from a different set.
edit: Correction, ~880 reads per second.
But I agree it's a fraction of 7k/sec peak for twitter.
However, twitter does not have to parse html, has no plugins to execute or templates, and has a max string length of 140 characters which is trivial.
Each post/comment published on wp.com takes many, many more cpu cycles than twitter.
What Twitter does is not hard, and they do it badly.
You tweet from your mobile phone app (maintained by twitter) or twitter.com, and that tweet gets posted on your public timeline. The tweet is parsed for mentions, and it is also copied on to the mentionee's incoming timeline and their mentions timeline.
The tweet is parsed for hashtags, and active searches (i.e. ones open on twitter.com, or via the APIs) and is also copied onto those timelines.
Also, you have followers. So Twitter also copies the tweet onto the inbox timeline of each of your followers.
Not only is all this information published in real time on Twitter.com, but it is also made available via JSON API, Streaming API and Firehose API.
All tweets (on all timelines) are stored forever.
Twitter's scale is hard to fathom - all of this processing is way beyond what your Rails / Django app could process with a MySQL backend. MySQL replication wouldn'e even come close to keeping up with the sheer volume of events to be processed.
To make matters more complicated - Twitter is expected to scale to meet the demand of emerging world events (eg: Egypt, Iran, snowstorms, hurricanes, earthquakes, bushfires). These events don't evenly spread traffic across Twitter's network, but instead provide "storm surges" of localised intense traffic.
Oh, and Twitter haven't just launched an analytics product?
I think for sheer engineering at scale, there are maybe only about half a dozen other companies in the same league.
(Edit: grammer changes for readability)
Twitter has become impressive, but let's not overstate its achievements.
So with a good design you have groups of servers doing the different stages in the queue.
One you've got the pattern down for 100 tweets per second, the pattern should be reproducible by scaling servers in each queue to 1000 tweets per second, and eventually 10,000 tweets per second.
The database requirements may explain why it's all done in one datacenter instead of trying to do replication across the country/world.
http://www.quora.com/Twitter-Inc-company/Why-does-Twitter-ne...
I also discovered they have their own (but singular) datacenter:
http://engineering.twitter.com/2010/07/room-to-grow-twitter-...
But they are planning on adding more, which leads me to believe maybe that's what some of the new hires are for.
Exactly why quora is compelling. If you didn't know now you do
They don't have an ad sales force right?
They don't have a billing department right?
Maybe they have housekeeping and food prep people included in that 350?
I honestly don't know and my instinct could be very wrong, but 350 seems crazy high.
I'm sure there's more, this is just what came off the top of my head.
Sure when independent a single guy can sit there and create something like that solo, inside Twitter though there would be a lot more process and interaction to achieve the goals.