NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive Flume Oozie Sqoop HDFS ZooKeeper Cascading Cascalog BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Amazon DynamoDB Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Amazon SimpleDB Datomic MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter



Activity Feeds with Redis

The how:

One brief note about architecture: since it’s impractical to simply query the activity of 500 friends, there are two general approaches for building scalable news feeds:

  1. Fan-out on read (do these queries ahead of time and cache them)
  2. Fan-out on-write (write follower-specific copies of every activity so when a given user asks for a feed you can retrieve it in one, simple query)

And why Redis:

First off, why Redis? It’s fast, our data model allows us to store minimal data in each feed entry, and Redis’ data-types are pretty well suited for an activity feed. Lists might seem like an obvious choice and could work for a basic feed implementation, but we ended up using sorted sets for two reasons:

  1. If you use a timestamp as the score parameter, you can really easily query for feed items based on time
  2. You can easily get the union of multiple sorted sets in order to generate an aggregated “friend feed”

Then the code in Ruby and PHP

Original title and link: Activity Feeds with Redis (NoSQL databases © myNoSQL)