How Facebook deals with memcache consistency in multiple datacenters
new.facebook.com
new.facebook.com
I'll have to look through the code one day and see why this makes no sense.
Nonetheless, I can appreciate how a simple approach solves the problem. If these are the most dramatic scaling issues that facebook faces, then this provides strong support to the argument that you shouldn't focus too much on scaling and optimization when first building your site. There are probably better uses of your early time.
Basically, the only change that needs to be done is that you have MySQL trigger the delete from memcached on replication. All your slave database gets an updated record for you, saves it in its tables and then hits memcached with a delete command for that key. While it does mean diving into the MySQL code, when you get to the size at which you need such a feature, you can just hire a MySQL expert.
But then I realized I was imagining a single MySQL DB at each datacenter. In reality they must have pretty big clusters at each.
That being said we are rapidly moving towards a world with more and more data being stored and queried. Scalability will therefore be something you increasingly need to know about in order to build a significant application -- regardless of your entrepreneurial ambitions.
But yes, I suppose it wouldn't be considered true multi-homing.
When you issue a delete you can specify "the amount of time the client wishes the server to refuse 'add' and 'replace' commands"
Maybe they couldn't afford to increase the read load so much but this seems easier than rewriting mysql's replication engine.
Here is a setup where you can scale with memcached
All the js/css/other stuff facebook includes on their homepage (one server round trip each).
Before they spent the millions it takes to bring up another data center they should have read this:
http://developer.yahoo.com/yslow/help/#guidelines
Also, I disagree that 70ms makes that big of a difference. People are more used to slow sites then people realize - anything less then 200+ ms improvement in the aggregate and I wouldn't spend a dime (not to mention millions of dollars).