[Sort of] Design Instagram

Interview practice with an ex-non-FAANG engineer

In this article, we look at the interview transcript, thoughts, and notes for the system design question “Design Instagram” in the style of the modern distributed system interview.

Time remaining
100 %
  • Candidate: Hello?
  • Candidate: Can you hear me?
  • Candidate: Oh, I think you’re muted.
  • Interviewer: Oh, sorry. Hello! Is now still a good time?
  • Candidate: Yep!
Time remaining
88 %
  • Interviewer: Great! Let’s start with some basic introductions.
  • Interviewer: I’ll go first. I’m Senior Architect Developer…
  • Interviewer: 👋 😏 🤑
  • Interviewer: 👔 🧑‍💼 💻
  • Interviewer: ⌛ 🏢 🏅
  • Interviewer: 💬 💬 💬
  • Interviewer: How about you?
Time remaining
80 %
  • Candidate: 👍 👍 🔥 🔥 🏆
Time remaining
79 %
  • Interviewer: Ok, for today’s problem, we’re going to be designing “Instagram”. Are you familiar with this?
  • Candidate: Yes.
Candidate thoughts

Crap.

Ok, something about fanning in and out?

The celebrities are supposed to.. damn it.

Alright, alright. Just take a deep breath. Start the question from scratch and don’t worry about finding the answer immediately.

Ok, that means the requirements. What are the requirements.

  • Interviewer: 🤔
Interviewer notes

Taking a really long time to get started.

Seems nervous?

Time remaining
71 %
  • Candidate: Ok, let’s start with the requirements.
  • upload photos media
  • view media
  • view timeline
  • follow people
  • comment
  • Candidate: uhm.
Candidate thoughts

Oh, crap the non-functional requirements.

What are those supposed to be again?

Time remaining
63 %
  • Candidate: Ok - uhm - beyond these, we’ll also want to make sure we can scale a lot.
  • Candidate: And like - we don’t lose the media after it’s uploaded. We also want to make sure everything is really fast so people really love the product.
  • scale!
  • don’t lose the media
  • really fast
Time remaining
55 %
  • Candidate: Ok for the scale, let’s do some back of the napkin calculations so we know what scale we’re designing for.
  • Candidate: Suppose we have 100 million DAU. A lot of people are really just browsing so we know the system is read-heavy. Let’s say 100:1 reads to writes.
  • Candidate: Ok and a photo is like 1mb and a video is uh..
  • Candidate: Like 100mb?
Candidate thoughts
Ugh, IDFK
  • Candidate: Ok, that means we’ll be storing uh..
  • Candidate: Uh..
  • Interviewer: Let’s assume it’s a big number. What’s next?
Interviewer notes
sucks at math
Time remaining
46 %
  • Candidate: Ok let’s look at the happy path for uploading.
graph LR
user--1-->app
app--2-->raw
app--3-->db
app--4-->pubsub
app--5-->user
pubsub--6-->processor
processor--7-->encoded
  1. request to upload
  2. add file to object store
  3. store metadata in db
  4. queue up so media can be processed
  5. return response to user
  6. process media
  7. store encoded in a different object store
Time remaining
33 %
  • Candidate: Of course if we really start scaling up, we’ll need some caches in there.
  • Candidate: And load balancers.
Candidate thoughts
OH CRAP THE TIME
  • Candidate: Let’s take a look at some of the other actions.
  • Candidate: 👋 🖐️ 🤟 🤘 👋 🙌 🤲 🙏 🙏
Time remaining
16 %
  • Candidate: Ok, let’s see if we have everything…
Candidate thoughts
OH CRAP THE CELEBRITIES
  • Candidate: Of course, we also have the case where some celebrities are on the site and we’ll want to make sure they have a good experience, too.
  • Candidate: 🌀 CACHE 🤟 👀 REDIS 🤘 👋 🙌 FANOUT 🤲 🔥
Time remaining
6 %
  • Candidate: And I think that should do it!
  • Interviewer: Well looks like we’re out of time. Thanks for taking the time to interview with us.
Interviewer notes
wtf?
  • Candidate: Likewise, thank you! I really enjoyed it!
Candidate thoughts
FML