Design Instagram
Key takeaway:
- Design media (image) post , get service.
- Design image feed service (pull vs push) tradeoff. High fanout users (many followers > 1 M / celebraties) we should use pull in the subscribers.(Or do push in batches) For all low fanout use the push method to push the post to the relevant feeds.
- How do you handle the comments and like in the post
- How to handle follower and followee
- Instagram System design done by GKCS. talks about mainly how to design instgram DB (sql database) and some generic talk about scalablity. Does not talk about no-sql DB design. Lot of emphasis in DB schema design.
- Schema (SQL)
2. Another video which is from the facebook engineer (more practical)
I personally liked this video and talks a lot about the instagram infrastructure.Sheds some light in:
How memcache is used, postgre sql , schema design, like table seperate from the activity table for faster DB access. Multiregion handling of the cache across Data Centers. PostgreSQL replication (master->slave)
Scale both the stateful service (DB) and stateless (compute) seperately scaled
PostgreSQL setup in “Master → Slave” fashon. All Writes go to master reads form replica. Extra latency of “Master → Replica” does not hurt much performance
Cassandra for timelines and user activity. Eventual consistency is OK
PostgreSql for the user, friendship and media metadata