How to ace the System Design Interview in 2022
Tags: systemdesign, tech, interview
Published: 2022-06-01 07:47:08

Do you want to be better prepared for your next System Design interview ? Here's a very simple way to go about it.

**Overall goal:**
This is a chance to demonstrate your design thinking, your technical knowledge.  Most importantly - your opinions.
for e.g. - it means not just knowing the meaning of NoSQL and SQL, but when do we use one vs the other. It is possible to use both (any) of these in the same system you will be designing. Knowing under what circumstances would you go for one vs the other.

###1. Ask Questions
Just imagine, your PM asked you to develop a feature with one line description, how would you go about it. You would want to gather as much info as possible, right?
Same goes here. Think of all possible questions - who are we designing this for, what problem are we solving? How many users might use this and how ? And so on.

While your interviewer is answering those questions, it's a great practice to write down those on the whiteboard.

###2. Back of the envelope calculation
For determining number of requests per second (in turn to determine how many nodes required to scale), for calculating storage required per year and so on. 
Sometimes the interviewer does not care for this. So, go for this only if the interviewer asks something like 'design a system which should support 50 million users per month'.

###3. Start with the data model
Think about this, what is your system at the bare minimum ? It is basically data and the components we build on top of it.
What were people doing before the cloud era? Before software era, even. It was just files and book keeping. Which is essentially data.
So starting with defining what the tables look like, is a great way to start designing your system.
Then choose a database that fits the model better. 
Do tables have strong entity relation -> RDBMS. 
No relation or not much relation with less tables -> NoSQL.
Nodes and relationships -> graph database
You get the gist.

###4. API Design
A lot of the times, in a system design interview you would also be asked to design the APIs. API design itself is a whole different topic. 
Even for this, you would have to start with the data model first. Then go with exposing that data over REST via APIs. 
I found this MuleSoft PDF to be the best one so far.
https://www.mulesoft.com/lp/ebook/api/restbook

###5. Pick any area where you can deep dive
It could be database scaling, it could be solving concurrency issues or metrics and analytics. Pick one (or more). And be ready to go deeper into these topic(s).
When I started, I had the impression that the crux of the interview is basically drawing those boxes and lines. (user, service, database). I know, so naive.
But it's actually this. Just showing what you know and have learned so far. And being able to discuss those choices and trade offs.
To get into that mode of thinking - 
a) Get started with the basics first. Reliability, Caching, Consistent Hashing and so on. https://github.com/donnemartin/system-design-primer. 
a) It helps if you have read the [DDIA](https://www.amazon.com/Designing-Data-Intensive-Applications-Reliable-Maintainable/dp/1449373321) book. This is a great book to actually understand the basics like load, reliability, CAP theorem. Also a great idea to go through the references mentioned by the author.
b) Reading major tech blogs. These talk about a specific problem and it is good to know what those are and how were they solved.
c) Taking notes of all your reading, in a structured and a concise way. I would simply go through these two days before the interview.

###6. Talking about failure scenarios
Anything and every component in a system can fail. How to handle specific error scenarios effectively is very important. Having a distributed system is not enough.
Read about load shedding, exponential back-off, replication and so on.

**Some great resources on the internet that I have learned a lot from.**
#####1) Microservices pattern
https://microservices.io/patterns/microservices.html
https://docs.microsoft.com/en-us/azure/architecture/microservices/design/patterns
#####2) Common System Design Patterns
http://highscalability.com/blog/2010/12/1/8-commonly-used-scalable-system-design-patterns.html
#####3) Scaling MysQL - GitHub blog
https://github.blog/2018-06-20-mysql-high-availability-at-github/
https://github.blog/2021-09-27-partitioning-githubs-relational-databases-scale/
#####4) Stripe's Rate Limiter
https://stripe.com/blog/rate-limiters
#####5) Twitter - Timelines at scale
Watch this wonderful video on how twitter scaled its rendering of home and timeline. By Twitter's Senior Director of the Applications Services Group at that time.
https://www.infoq.com/presentations/Twitter-Timeline-Scalability/
#####6) AWS Kafka
I found this to be a great explanation of Kafka. If anyone wants to understand messaging systems - please read this.
https://aws.amazon.com/msk/what-is-kafka/
This one requires educative subscription. Deep dive into Kafka and its components. https://www.educative.io/courses/grokking-adv-system-design-intvw/g7z2zNY9RR9
#####7) Azure Architecture fundamentals
https://docs.microsoft.com/en-us/azure/architecture/guide/
#####8) AirBnb - Scaling Financial Reporting
https://medium.com/airbnb-engineering/tracking-the-money-scaling-financial-reporting-at-airbnb-6d742b80f040
#####9) Basics of AWS services
This provides a nice overview of AWS services
https://www.educative.io/path/fundamentals-of-aws

_All are non-affiliated links._

I am curious to know what your favorite resources are. If you liked reading this article, please hit the :heart: button !