我正在尝试制作一个用户通知系统(如facebook)
我有 mysql 表,它简化为;
user : id,username
post : id,user_id,text
comment:id,user_id,post_id,text
post_like:id,post_id,user_id
friend:id,owner_id,follower_id
您可以看到表之间的关系。此通知系统应该允许用户跟踪帖子下的评论,该帖子的所有者或触摸该帖子(点赞或评论),
跟踪帖子所有者或触摸该帖子的帖子上的点赞操作(点赞或评论),
通知友谊行为和类似行为。
首先我想用另一个表来解决它;
notification: id,notification_type,user_owner,user_other,isNotified,date
ntype:id,type (such as friendship,add a comment, like a post etc.)
因此,当用户执行操作时,我只需将操作插入到通知表中,然后在客户端上,我将使用 ajax 检查登录的用户是否有任何通知(isNotified=false)
之后只需更新 isNotified=true 即可。
在这种情况下,我如何通知其他用户触摸帖子(评论或喜欢)。在这种情况下,它只是通知帖子的所有者。
此外,当我在研究时,找到 通知队列,我认为这是实现类似功能的更好方法。那么您能否提供一些有关如何实现通知的详细信息queque..
我也很好奇它的性能问题。假设有 10 万用户,每个用户每天有 10 个帖子和 100 个评论,会发生什么。那么会发生什么呢?
我是否应该考虑一些 nosql 解决方案来完成这项工作,例如 neo4G 或 mongodb?
谢谢..
I'm trying to make a user notification system(like facebook)
I have mysql tables which simplified like ;
user : id,username
post : id,user_id,text
comment:id,user_id,post_id,text
post_like:id,post_id,user_id
friend:id,owner_id,follower_id
You can see the relations between tables.. This notification system should allow to user track comments under a post which owner of a post or touched to the post(like or comment),
track like action on a post which owner of a post or touched to the post(like or comment),
notify friendship actions and similars.
First I think to solve it with another tables ;
notification: id,notification_type,user_owner,user_other,isNotified,date
ntype:id,type (such as friendship,add a comment, like a post etc.)
So when a user make an action I'll just insert the action on notification table then on client I'll check with ajax the logged user has any notification(with isNotified=false)
after that just update isNotified=true.
In this scenario how can i notify other users which touch a post (commented or liked).. It's just notifiying to owner of post in this case..
Also while i'm researching find the notification queque, I think it's better way to implement something like that.. So can you give some details about how to imlement a notification queque..
I'm also curious about performance issues about it.. Let say what happens if have 100K user and each user has 10 post and 100 comments,likes daily. Then what will happen?
Should i consider some nosql solutions for this job such as neo4G or mongodb?
Thank you..
发布评论