Design Instagram

Deepak Pant
2 min readSep 25, 2019

--

Key takeaway:

  1. Design media (image) post , get service.
  2. 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.
  3. How do you handle the comments and like in the post
  4. How to handle follower and followee
  5. 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.
  6. 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

Instagram architechure

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

--

--

Deepak Pant
Deepak Pant

Written by Deepak Pant

Engineer, thinker and designer

No responses yet