nosql - Sync in Cassandra data model -
i'm creating social network app , i've denormalized data creating timelines list of posts containing fields in order using 1 query. issue if every post has counters (likes, shares,comments), everytime counter updated how can sync post record in timeline? or should have id in timeline , update 1 table of posts , timeline query made of 2 query instead of one?
thanks in regards
i've been thinking similar task , here's idea:
timeline data must synced. storing id in timeline , looking in posts bad idea: wouldn't want make 20 lookups generate single timeline page. also, won't scale: once add more nodes server architecture, different posts can stored on different nodes , make queries slower.
it seems best use
counter
data type storing counters. requires creating separate counters-only table. see here more info. understand using type improves scalability (of updates).if writing timeline every new like/comment/share becomes expensive, in-memory cache can employed: counters stored in cache , looked when timeline generated. timeline stored values updates delayed , serve fallback counters not in cache. looking 20 times ram single request ok think.
#3 can useful if count entry views. since you're not counting views, updating timeline on every like/comment/share alright think.
Comments
Post a Comment