and item pages • Hunch taste graph for eBay users and items • Many time series use cases Why Cassandra? • Multi-datacenter • Scalable • Write performance • Distributed counters • Hadoop support ACE
state is durable •Immediate consistency with no leader election or failover •ConsistencyLevel.SERIAL •http://www.datastax.com/dev/blog/lightweight- transactions-in-cassandra-2-0
id=?”) futures = [] for id in users_to_fetch: future = session.execute_async(fetch, [id]) futures.append(future) users = [f.result()[0] for f in futures]
text, PRIMARY KEY (username, tweet_id) ) WITH CLUSTERING ORDER BY (tweet_id DESC) •Partition by user •Cluster by timeuuid (timestamp) •SELECT * FROM tweets_by_user WHERE username=? LIMIT 100
timeuuid, author_username text, body text, PRIMARY KEY (username, tweet_id) ) WITH CLUSTERING ORDER BY (tweet_id DESC) •Denormalize, append to each follower’s timeline •Extra writes, cheaper reads