new features, now CTO at Soho Tech Labs Learning to use Keynote Generalist programmer I like the internet I don’t love databases I just want some place to put my data
parts Progressing to the strengths Debunking the (possibly strawman) argument that there is some magic DB that is suited for everything. An example of how the various solutions can play well together
of work • Facebook still using it for most data • 60 million+ queries/second • Horizontal scaling of big tables: Sharding • Facebook has 4000+ shards • That is a lot of shards • They had to roll their own, as do most people who use MySQL • MySQL Cluster auto-shards, but...
ALTERs are expensive • Very realistic example: • We’re the City of New York, we have a database of a little over 8 million people • Sometimes we want to track new things about these people
• Very new • Famously uses Global Write Lock • Less people out there with experience scaling it • Less people with experience building on it • Many tickets out to improve key deficits • Fewer tools -- for e.g., migration of old documents • Devs familiar with RDBMS need to understand new concepts
• it’s been around awhile - stable • fast, with the right optimizations • Mongo • schemaless, no ALTER needed • automatic failover in replica sets • auto-sharding • Redis • Memcached on steroids
properties evolve fast, we don’t want ALTERs or rigid structure • Order of posts is stored in Redis, per-site • Single Redis instance can serve nearly a million QPS -- gives huge amount of headroom • We can query for e.g. latest post IDs with almost no overhead • Very memory-efficient It’s the hybrid!
can compose the list of posts needed to show a home timeline in advance. • Frontends don’t have to query “most recent posts by [list of 1000 users the user i friends with]” • Great for storing summary counts and similar -- INCRBY command • Remove Memcached. Memcached is great, but unneeded if you’re using Redis.
• User preferences, etc. • Arbitrary SQL queries can be made for reporting, e.g. # of users with connected Twitter accounts • Simpler to find developers • Code re-use • Not sexy, but known quantity
still the gold standard for geo • Good spatial indexing • Can build on top of e.g. GeoDjango • On Casahop.com - get nearby houses, upcoming search within specific geographic area, etc.