System Design is the process of designing the architecture, components, and interfaces for a system so that it meets the end-user requirements.
It’s a wide field of study in Engineering and includes various concepts and principles that will help you in designing scalable systems. These concepts are extensively asked in the Interview Rounds for SDE 2 and SDE 3 Positions at various tech companies. These senior roles demand a better understanding of how you solve a particular design problem, how you respond when there is more than expected traffic on your system, how you design the database of your system, and many more. All these decisions are required to be taken carefully keeping in mind about Scalability, Reliability, Availability, and Maintainability. We will be covering all of these terminologies in this article.
Before we start discussing the terminologies, there are few things we should need to clear about. When you are given a System Design Problem, you should approach it in a planned manner. Initially, the Problem may look huge, and one can easily get confused on how to start solving it. And moreover, there is no fixed solution while you are designing a system. There is more than one way to reach the Solution.
So let’s discuss how one should start with solving a Design Problem given in an Interview.
Approaching a Design Problem
- Breaking Down the Problem: When you are given a Design Problem start breaking it down to small components. These components can be Services or Features which you need to implement in the System. Initially, a System given to be designed can have a large number of features and you are not expected to design everything if it’s an Interview. Ask your interviewer about the Features you are planning to put in your system. Is there anything else you should be putting there? Any Feature? Any Service ? … Ask!
- Communicating your Ideas : Communicate well with the Interviewer. While designing the system keep him in the loop. Discuss your process out loud. Try to demonstrate your design clearly on the whiteboard with flowcharts and diagrams. Describe your ideas to your interviewer, how you have planned to tackle the problem of scalability, how you will be designing your database, and many others.
- Assumptions that make sense : Make some reasonable assumptions while you are designing the System. Suppose you have to assume the number of requests the system will be processing per day, the number of database calls made in a month, or the efficiency rate of your Caching System. These are some of the numbers you need to assume while designing. Try to keep these numbers as reasonable as possible. Back up your assumption with some solid facts and figures.
Now we know how to approach a design problem. But in order to succeed in the Interview or to successfully build a scalable system, we need to ensure that our system is reliable, available, scalable, and maintainable. So we should have knowledge of what these terms are and how they impact our system in the long run.
Reliability in System Design –
A system is Reliable when it can meet the end-user requirement. When you are designing a system you should have planned to implement a set of features and services in your system. If your system can serve all those features without wearing out then your System can be considered to be Reliable.
A Fault Tolerant system can be one that can continue to be functioning reliably even in the presence of faults. Faults are the errors that arise in a particular component of the system. An occurrence of fault doesn’t guarantee Failure of the System.
Failure is the state when the system is not able to perform as expected. It is no longer able to provide certain services to the end-users.
Availability in System Design –
Availability is a characteristic of a System which aims to ensure an agreed level of Operational Performance, also known as uptime. It is essential for a system to ensure high availability in order to serve the user’s requests.
The extent of Availability varies from system to system. Suppose you are designing a Social Media Application then high availability is not much of a need. A delay of a few seconds can be tolerated. Getting to view the post of your favorite celebrity on Instagram with a delay of 5 to 10 seconds will not be much of an issue. But if you are designing a system for hospitals, Data Centers, or Banking, then you should ensure that your system is highly available. Because a delay in the service can lead to a huge loss.
There are various principles you should follow in order to ensure the availability of your system :
- Your System should not have a Single Point of Failure. Basically your system should not be dependent on a single service in order to process all of its requests. Because when that service fails then your entire system can be jeopardized and end up becoming unavailable.
- Detecting the Failure and resolving it at that point.
Scalability in System Design –
Scalability refers to the ability of the System to cope up with the increasing load. While designing the system you should keep in mind the load experienced by it. It’s said that if you have to design a system for load X then you should plan to design it for 10X and Test it for 100X. There can be a situation where your system can experience an increasing load. Suppose you are designing an E-commerce application then you can expect a spike in the load during a Flash Sale or when a new Product is Launched for sale. In that case, your system should be smart enough to handle the increasing load efficiently and that makes it Scalable.
In order to ensure scalability you should be able to compute the load that your system will experience. There are various factors that describe the Load on the System:
- Number of requests coming to your system for getting processed per day
- Number of Database calls made from your system
- Amount of Cache Hit or Miss requests to your system
- Users currently active on your system
Attention reader! Don’t stop learning now. Get hold of all the important System Design concepts with industry experts. Join System Design Course to attend live classes.