3

I am trying to build an activity feed/news wall in a Django app based on an asynchronous friend relationship. I found this previous SO post, but it seems too simple. There is a good Quora answer to this problem from Ari Steinberg, who made the Facebook News Feed.

Unfortunately, I am still in the planning stages and do not have any code written for this problem. The tricky part seems to be how to update a feed quickly without calling every person you follow, sorting their activities, and then rendering the amount you want to display. Letting the user login, and quickly see the most recent posts from the users they follow is my main concern.

Has anyone tried this in Django? Have any advice? I am sorry this isn't incredibly in-depth but thanks in advance for your thoughts.

Community
  • 1
  • 1
user687809
  • 31
  • 2
  • 1
    Consider turning your activity feed data structure on its head: instead of concerning yourself by scanning "every person you follow," concern yourself with "updating feeds when something interesting happens." One feed per person, and whenever a POST happens to your system (ought to happen much less often than a GET, right?), scan a list of "people interested in User X, Event Y" and post to their event tables. Such tables are easily shardable for read purposes. – Elf Sternberg Apr 01 '11 at 19:46
  • Just read Ari's comment. He's right: You need a "User X is interested in Event Y" table, and an "Events that happened that User X is interested in" table, and use signals to manage them. Django-actstream and django-activity-stream are two plug-in apps that takes similar approaches. – Elf Sternberg Apr 01 '11 at 19:51

0 Answers0