Instagram Design

 


Instagram design

Top Features

1.     User registration/login

2.     Feeds on home page from fav people

3.     View Comments/Add comment

4.     Create post

5.     Reels

6.     Keyword search

 

Data store – User Profiles

  • 1.     Millions of users
  • 2.     Users linked with each – Graph DB

Data storge – User content - Relational

  • 1.     User ID
  • 2.     Content ID
  • 3.     Content URL
  • 4.     Uploaded date time

 

Create Post – Rest API –

  • ·       Content Upload – Reviewed – Virus Check - Categorized – Tagged – Stored.
  • ·       Storage – in S3 IA and eventually moved to other S3 buckets
  • ·       Content cached in Cloudfront spread globally
  • ·       API is going to be hit million times a day – API gateway
  • ·       Availability – taken care by multi-AZ, multi- region arch
  • ·       Scalability – taken care by the container platform and elasticity

·        

Queue based Feed publishing

  • ·       Whenever there is new post created – event is triggered – “Post created”.
  • ·       Feed is implemented as message queue. A message is triggered to the feed queue.
  • ·       Program listens to “Post created” event.
  • ·       Pick the post details and push it to the feed of all linked users.
    • o   Get API for picking the post API
    • o   Get API for getting friends of current users
  • ·       Listener program picks up the message and refreshes the feed of friends of the current user. The message header will have the list of friends whose feed should be refreshed.
  • ·       Millions of users are going to be posting to the queue and listener programs will have to deliver the feed to respective users. Should be highly available.
  • ·       Fault tolerant, non duplicate confirmed delivery
  • ·       The feed will be refreshing when the user is viewing the content which will not be a good user experience.

AI based feed generation

  1. 1.     Based on user interest
  2. 2.     Prioritizing feed ranking from different friends of user – based on user interactions with the in the past
    1. 3.     Post since last visit
    2. 4.     Feed table
    3. a.     ContentID
    4. b.     ContentType
    5. c.     ContentAuthor
    6. d.     Status – Pending Push
    7. e.     Last published time
    8. f.      Targeted user
    9. g.     Targeted user last login
  3. 5.     AI engine based on Pt 1-3 will spot the content which is relevant to the user and add it to the feed table.
  4. 6.     When the user logs in the feed will be pushed to the user.

 

Handling of streaming data

  • AWS Firehose can be used for ingesting, transforming and pushing streaming data to clients.
  • Http endpoints can consume streaming data.
  • Traffic from hose to endpoints will be encrypted.

 

 

 

 

Comments

Popular posts from this blog

AWS Organizations, IAM

Key Concepts

Linear Algebra Concepts