Friday, February 27, 2009

Friendfeeds use of mysql

I'm not a super big fan of the database, mainly because I'm an OO guy and RDBMS is clunky when doing O-R mapping. Before you start flapping, I've worked a lot with them and they are definitely useful!

Anyways.. I was reading an interesting article about how FriendFeed are using MySQL, but not in the traditional schema-heavy approach.

At my last place, adding a column or index to an existing MySQL database can take a LONG time if you have say 10M rows. To prevent your database being offline (which usually means your main webapp being offline as well), you have to starting using db-slaves and then doing a swaparoo. uuggh

FriendFeed uses a schema-less attitude to MySQL and uses tables as a key-value stores. It's kinda what you would have to do if your datastore was on Amazons S3 (before you had all these fancy shmancy products like SimpleDB and Persistent storage).

They have separate tables for *each* index, which prevents table lock up. Keeping all that data in sync when doing writes becomes a PITA, but its manageable.

It's a nice approach. I've implemented something similar, a key-store schema-less solution as well, but didn't have the scaling problems that forced me to think about using indexes in MySQL.



No comments: