If you want to learn a programming language like Java or Python, but creating software using those programming languages is a totally different thing. System design or software design is a tricky concept to master.
In this article, I will share with you a template that would help you if you are preparing for a system design interview.
There are two parts in this article- Preparation, Template.
Preparation
The first thing, you have to keep in mind before designing a system is you have to learn the fundamental concepts. Knowing all the basic fundamentals concepts will help you in making the right decision in your system design.
After learning basic concepts, it is now time for designing. Firstly, you have to think of a use case and then try designing all the components and think of how you can make your system fault-tolerant and robust. In this whole process, you apply the concepts and learned in designing the system.
Question To Ask Yourself
What are the architectural pieces that can be used?
How do these architectural pieces work with each other?
How can we best utilize these pieces?
What are the right trade-offs?
Key Points For Interview
Never use any buzz word ( tech stack ), Don’t get into details prematurely, justify your design decision.
System Design Template For Interview
Requirements.
Storage estimation
Database design
High-level system design
Additional components
Requirements
There are two types of requirements for the system design interview.
Functional
What all the system has offered to the user?
Example
A user can follow another user like share, tweet, share a tweet.
Non-Functional
You have to design pattern online training based on the system, there are some following concepts that must be considered- for a banking system, consistency is the important thing to be considered as there cannot be discrepancies in data.
High Availability
Except for the banking system, most of the systems require high availability except banking systems.
Consistency
The systems that have high availability will have eventual consistency.
Reliability
No data loss.
latency
Response time of an action.
Storage Estimation
Based on the data modality
An estimate of how much data must be stored to know the type of database can be used and fill the storage for images, videos.
No. of requests to the service
To know about how to scale the services. A service to handle high traffic of requests.
Read-write ratio
Determine if the system is read-heavy or not.
Database design
After discussing the actions and data that a user can perform to interact with the system. The next step is talking about the type of database will use and why.
High-level system design
Step 1)
Basic Design:
Client
Application server
Database
Step 2)
Extending the design creating specific components.
Isolate the services- For traffic control and easier scaling.
Replicate the services and databases- Mention every single point of failure.
Load balancer- application side and database side.
Message Queues- Tight to loose coupling/ synchronous to asynchronous communication.
Data partitioning- based on location, based on user ID.
Content Delivery Network- Avoid round trips to the main serves. (improves latency).
Cache- Distributed cache and client-side cache.
Additional components
If you have time left in the interview, the components can be added to the design. These components of knowledge help you answer any in-depth follow-up questions. Generally, these components also take most of your time in the interview.
Encryption- for messaging services.
Analytic Services- for analyzing requests and user data.
ML Services- Recommendation/news feed ranking- talk about the Data Structures Courses needed for the recommendation/ ranking model.
API Gateway- detailed microservices, and API Gateway
Services Discovery- Dynamically identified microservices.
By the use of these templates, any system can be designed.