facebook - Implementing Notifications in Rails -
in application, want notify user, when he/she mentioned in comment or post.
user handle @user_name
, similar facebook.
database table mentions looks like:
mention mentioned_by: user_id (foreign key) user_mentioned: user_id (foreign key) comment_id: (foreign key) post_id: (foreign key)
i can't figure out way implement though. how facebook / twitter it?
what decided go with, use activerecord callbacks/ observer design pattern
, whenever new comment/post saved database, can go through contents of post/comment, , out mentions , execute notifications required.
i feeling there missing pieces , not getting right.
best way of doing it?
facebook , twitter not mid-size rails applications. companies. tech runs them distributed , custom, in case of facebook.
the part seem grasping how determine notify in performant , scalable way. shit gets real. can find lot of information architecture behind each on of them, , there lot of great stuff think these things, none of going implement whatever application you're building.
http://www.quora.com/what-is-facebooks-architecture
http://www.infoq.com/news/2009/06/twitter-architecture
http://engineering.twitter.com/2010/10/twitters-new-search-architecture.html
plenty more juicy details on @ quora.
unfortunately, none of gets closer goal. think realistic thing start out woud tie in service pusher send messages clients without worrying it, use activerecord observer add notifications background queue workers send notifications pusher. day or less of work , should scale @ least 10k notifications day. once start having performance problems, ditch observer , pusher goliath can handle both of jobs locally.
bottom line, learn can large , experienced systems have been put through paces, see problems ran , how solved them. these methods aren't same among big guys even, , going vary each implementation.
hopefully helps point in direction. :)
Comments
Post a Comment