Instagram
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 11 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How many uploads a second must you plan for?

      How much new media lands every year?

        How big do likes get compared with posts?

          How many image requests a second, and how many reach disk?

            Build-up · 5 steps

            Build the high-level design

            One functional requirement at a time, ending with an Instagram that works for a few million people in one region.

            Step 1 of 5

            Upload a photo

            Bytes skip the API: the phone sends them straight to object storage with a signed URL, while the post service saves the post as processing and queues a job. Workers make the variants, then mark it ready.

            6 interview moments

            You’re the candidate

            The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

            1. Deep dive 1 of 6

              Interviewer

              “Diwali night, a ₹8,000 phone, a flaky connection. How do you make “I tapped Share and it was there” true?”

              Your move. Pick an approach:

            2. Deep dive 2 of 6

              Interviewer

              “The CDN answers 90% of image requests. The other 175k a second are cold photos. What does each one cost?”

              Your move. Pick an approach:

            3. Deep dive 3 of 6

              Interviewer

              “Posts now live on many Postgres primaries, and auto-increment keys collide. How do you generate post IDs?”

              Your move. Pick an approach:

            4. Deep dive 4 of 6

              Interviewer

              “A film star with 300 million followers posts during the IPL final. How does the post reach feeds?”

              Your move. Pick an approach:

            5. Deep dive 5 of 6

              Interviewer

              “300 million Story items a day, each gone after 24 hours. How do you expire them?”

              Your move. Pick an approach:

            6. Deep dive 6 of 6

              Interviewer

              “A Bollywood star’s wedding photos draw 15,000 likes a second, all on one post. How do you count them?”

              Your move. Pick an approach:

            Build-up · 8 steps

            Follow one photo through it

            The two planes meet only through IDs and URLs. Small records move at high QPS; bytes move at high bandwidth, and no app server carries a photo.

            Step 1 of 8

            Upload

            The phone downscales the photo and sends resumable chunks to object storage with a signed URL, usually while the caption is still being typed.