3 ms·
Ask HN: How would you design Instagram?
I've gotten this problem _twice_ now from Trendy SV Companies and I've come up short each time. I'm clearly missing something in my explanation. If you give this problem, could you walk through the solution please?
Cheers!
- gitgud 6y agoWell that's a flawed question, as no one ever designed instagram, it evolved through iteration to its current state. If you tried to clone instagram now, it would take years to replicate every feature (for a single dev). A better answer is to say you would design instagram the way they originally did.... Start with a simple photo sharing platform and add features based on user feedback and demand. That way you're solving problems people are having, not copying a solution that already exists.
- natdempk 6y agoCan you talk a little more about the types of roles you're interviewing for and what your typical answer looks like? I think that would be useful to provide more context for any answer.
- sbuccini 6y agoSure thing. I'm interviewing for "senior software engineering" roles: full-stack, approximately 3-5 years out of school. To clarify, they specifically ask about the Instagram feed. Basic answer goes like this: v0: Webserver handling requests talking to a relational DB. Return feed via ORDER BY created_at DESC; v1: introduce CDNs to host image files closer to the client. v2: pre-compute user's feeds and store them in a NoSQL table. Where I struggle: * Solving the "push" vs "pull" aspect. v2 doesn't work well for influencers with huge follower counts. How to handle this case? I suggested a blended approach but didn't have many ideas on how to knit them together. * Would you still pre-compute the feeds even if people haven't logged in for a long period of time? I said we could bucket users into different categories of usage via an offline job and re-fresh their feeds on different cadences and store them in different levels of caching. Curious to hear how I can add more detail and extend my solution!