我的目标是使用apache cassandra根据用户的兴趣为每个用户创建一个新闻提要,我已经成功做到了这一点,但是我不知道当服务器处于负载状态并被请求淹没时它将如何执行。因此,这就是我为实现自己的目标所做的事情:
这是表格的样子:
id | content| contentid| date | poster| posterusername | viewer
89102|sometext| 1585 | *timestamp*| 5332 | thatcher | 7480
//id is the primary key
//content is the text posted
//contentid is the id of the post that uniquely identifies it
//date is the timestamp of the time it was posted at
//poster is the users userId
//posterusername is the users username
//viewer is the one of the posters followers
用户创建了一个帖子,创建的行数等于 用户拥有的关注者数量。例如,如果用户有50个关注者 将创建50个包含帖子内容的行
由于我使用的是cassandra,为了维持数据库的繁荣和高效,我必须避免使用allow filtering来执行此操作,因为我在viewer
列上使用了二级索引。当用户打开新闻源时,此查询由服务器SELECT * FROM content WHERE viewer = ?
运行,然后在ui中检索并显示该用户所关注的所有由用户创建的帖子
这是创建新闻源的好方法吗?当服务累积了更多用户时,它会表现良好吗?