Jump to content

Creating 'feed' of activity--most efficient setup?


amedhussaini

Recommended Posts

Hi everyone,

 

We have a social networking iPhone application that is constantly making API calls to our server in order to bring in information and write information to the database.

 

Every time a friend is added, a comment is created, etc (basically in a bunch of different tables things are being created)--we want this stuff to show up on one screen, like a facebook 'feed'.

 

I've thought about approaching this two ways, and I'd like some advice from the experts out there on the more efficient way to do it.

 

1. a lot of DB writes--in other words, everytime a user does something that does belong in the feed (like comment on something, or like something), at the same time the api can add a row to a new 'notifications' table.  that way, when i need to pull a feed for someone later on, i can just pull from this one table

2. one big read--currently, i don't have it setup like the above--the plan was to just query all the tables when u want to refresh your feed.. my api will return a big xml doc to the iphone and then the iphone will rearrange the data as needed

 

 

what do you think is the better approach?

Link to comment
Share on other sites

I personally would lean toward the notification approach.  If you have a solid generic design for you notification table, this will work fine, and also can be sharded effectively, since the SELECT needs to find activity for the user in question, and there doesn't sound like much of any need for searching across shards.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.