[Answered ]-Building Django Activity Feed using Redis

1đź‘Ť

What you are actually doing requires

  1. aggregation logic (which you can write in python since your main framework is django)
  2. a task queue running in the background which executes these aggregation logic
  3. denormalized and duplicated data in your redis database, repeating data which are relational in your main database, such as your postgresql database

You can breakdown your activity feed into its components which are aggregated together on redis but are related to each other on your relational database.

Bob and Kyle and poems and Beautiful piece are objects, respectively user object, user object, a poem object and a comment object which are stored in your relational database.

Your activity types are “following”, “liked”, “commented”.

You can then write your python logic to aggregate them into a single feed item which is stored in your redis database and each of these feed item is composed of objects and activity types (and a time stamp in which that activity happens).

That’s the primary design consideration to get started.

Here’s a good example – https://github.com/SupermanScott/redis-activity-example

👤Calvin Cheng

1đź‘Ť

Stream-Framework is an open-source library made to build feeds and supports both Redis and Cassandra as storage backends.

You can check it out on github

Disclaimer: I am one of the authors of Stream-Framework

Leave a comment