Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DB solution for user activity feed

I am wokring on a project where user activity feed generation is needed. If user A follows user B and user B does some activity user A see it on his homepage.

Now I am looking for a DB solution for persisting user feed. Once user B commits some action all users who follow user B will receive a record. I think saving a mongodb document for a user with a list of object references will be better than saving a document for each feed record.

On the other hand, there will be many writes and even more reads and mongodb has a lock on a collection. Maybe this might be a problem. Or maybe Redis could be used for this. And redis having something with concurrency. I am not much experienced in both.

The summary question is what would be better to use for this task: Mongo, Redis or something else?

Thank you!

like image 324
yun_man_ger Avatar asked Jun 11 '12 03:06

yun_man_ger


1 Answers

see the blogpost: http://www.waistcode.net/blog/mongodb-newsfeed-schema-design-for-entexis which exactly describes what you're looking for. IMHO: it's really elegant.

I was pointed to that blogpost through a related question ( MongoDB database schema design ) a couple of days ago.

hth.

like image 193
Geert-Jan Avatar answered Sep 23 '22 00:09

Geert-Jan