Detailed Design of Instagram
Take a deep dive into the design of Instagram and understand the interaction of various components.
Adding more components
Let’s add a few more components to our design.
-
Load balancer: To balance the load of the requests from the end-users.
-
Application servers: To host our service to the end-users.
-
Relational database: To store our data.
-
Blob storage: To store the photos and videos uploaded by the users.
Uploading, viewing, or searching a photo
The client requests to upload the photo, load balancer passes the request to any of the application servers, which adds an entry to the database. An update that the photo is stored successfully is sent to the user. If an error is encountered, the user is communicated about it as well.
The viewing of a photo is also similar to the above-mentioned flow. The client requests to view a photo, and an appropriate photo that matches the request is fetched from the database and shown to the user. The client can also provide a keyword to search for a specific image.
The read requests will be more than write requests and the uploading of content into the system takes time. It is efficient if we separate the write (uploads) and read services. The multiple services operated by many servers will handle the relevant requests. The read service will perform the tasks of fetching the required content for the user, while the write service will help upload content to the system.
To cater to millions of reads, we also need to ...
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy