Please enable JavaScript.
Coggle requires JavaScript to display documents.
Design User System - Coggle Diagram
Design User System
Service
Authentication Service
Session/Cookie
User Service
Friendship Service
Storage
attributes
NoSQL: MongoDB/Cassandra 10k
Cassandra
what
Row Key (e.g. user id)
Partition Key/ Hash Key
cannot do range query
Col Key
support range query
dynamic, and expand
Value
use cases
friend ship table
news feed
doesn't support transaction
Redis 10K /Memecached 1M
distributed/ auto-scale/ replica
MySQL/PosgreSql 1k QPS
Structured data, free index
use cases: user table
confidential/ multi indexs
Optimization
read >> write
use cache
should avoid data in consisitent
solution
add lock :red_cross:
reduce efficiency, cache meaningless
database.set(key,val); cache.delete(key)
ttl can only let data inconsistent to live about 7 days
write >> read
Cache Aside
Memecached + MySQL
scenarios
features
Sign up
log in
profile read and write
friendship
QPS
DAU 100 M
write 1time/10days 100M * 0.1/86400 = 100
peak * 3 -> 300
read 100 times/day
100 * 100M / 86400 = 100k
peak: 300k