System Design Interview 2: News feed like Twitter
In previous article , I show you how to design a URL shortener service. I presented the basics of capacity planning, collecting requirements, DB sharding, etc. Now, I would like to cover another interesting system design interview question - How would you design Twitter?
Requirements and capacity planning
We want a system that allows a user to share short text messages (posts). Those messages will be displayed in 2 places:
- on user board
- on home board
User’s X board displays posts that user X published. Every logged-in user Y has also their own private home board. Home board displays posts of users subscribed by user Y.
System Design Interview 1: URL shortener like TinyURL
A URL shortener is one of the most famous system design interview questions. In my opinion, it is also the most essential one from a scalability perspective and that is why global companies like the famous FAANG ask about it. Let’s go through it like during an interview to show you how you can structure this discussion.
There is no perfect system
Remember, there is no silver bullet to design the perfect system. There are also no good or bad answers to the question. It’s all about trade-offs and all you have to show is that you are aware of those trade-offs.
True NoSQL mindset
“You should use NoSQL here”, “SQL doesn’t scale” - those are the top buzz words you can hear at conferences or from candidates while interviewing for a software engineer position. 90% percent of the people cannot explain why is that. They simply repeat those empty buzz words to show that they are up to date with the “modern approach”. Is it really true that SQL does not scale? Let me put some light on the true mindset that stands behind NoSQL and SQL story.
Uniq Integer
From time to time I like to solve some algorithmic tasks on Hackerrank. First of all, it is good to change the domain after constantly working on different kinds of challenges in professional life like solving business problems, fixing bugs and scaling the system. Secondly, it always reminds me of a very good period in my life - study times. Unfortunately, having an outstanding knowledge about algorithms is mostly useless for most developers. Many companies having department in Poland, where I worked for several years, totally skip this part during the interview process. As far as I know, only huge western companies with a big pool of tech talents like Amazon or Google use to ask interview questions mostly related to algorithm and general system designs than to specific technology but this is a topic for a separate article. In this article, I would like to talk about the challenge found a long time ago on Hackerrank and few cool extensions that jump to my head after I found the solution.