System Design - Chapter 1: Basics of System Design
Designing a system is one of the most crucial parts of software engineering. A software engineer must understand various system design concepts like scalability, availability, performance, and tradeoffs.
While designing a system sometimes scalability is compromised for performance or vice-versa. At that time it's important to understand the need of your system and then decide accordingly. This situation of making decision between two important aspects of a system is known as tradeoffs.
What is system design?
System design in basic terms is designing the entities of a system and defining their interactions and relationships, to fulfill a set of functional and non-functional requirements.
The process involves taking a problem statement, then breaking it down into smaller elements and constructing each element separately in such a way that, together, they can work efficiently.
Approach for designing a system
Design a system
The best way to learn something is by practicing or solving real-world problems. In this learning series on system designs, we will explore concepts through fictional stories and practical examples.
Meet Harry, a fictional character working on his project, HogwartsDiary. Harry is deeply attached to his Hogwarts friends and envisions staying connected with them even when away from them.
HogwartsDiary is an application enabling users to send text messages, photos, and videos, sharing memories and thoughts with their connections.
Initially, he created the application in his system and used a local database for storing the data. Now, he wants to deploy the project so that his friends can also use the application and they can share their thoughts.
To achieve this, Harry acquires a machine with 100GB storage and 8GB RAM, setting the stage for deploying and running the application.
Important concepts of system design
Recommended by LinkedIn
Scalability
Harry was very happy with his work because he was able to share his thoughts with his friends and then he thought to help everyone with this application and he opened this application for everyone.
As the popularity of HogwartsDiary soared, the user base expanded, causing a rapid surge in the number of requests. At its peak, the system was handling 1L (100,000) requests per second. Unfortunately, the swift growth in users led to a server slowdown, prompting users to raise concerns about the system's decreased speed.
Harry took the initiative to address the issue by purchasing a machine with 64GB RAM and 500GB storage. This upgrade proved successful, and the server resumed working seamlessly. This approach of increasing the machine's size to accommodate more requests and improve performance is known as vertical scaling.
After some time, the server faced slowdowns again as the people of Hogwarts shared the application worldwide, contributing to its widespread popularity.
Harry was in the midst of another round of vertical scaling for the server, but his plans were interrupted when a sudden power cut occurred. This caused him to arrange for a power backup to ensure the continuous operation of his server. He realized that relying on a single server causes a single point of failure, and there is a limit to scaling a system vertically.
In response, Harry opted for a different strategy. He purchased multiple machines, each with 8GB RAM and 100GB storage, interconnecting them. Some of these machines were equipped with power backups to ensure continued operation during power outages. Now, with this setup, the system could scale horizontally by adding more machines to meet increased demand. This method of scaling the system by adding multiple machines that collectively handle requests is known as Horizontal scaling.
Load Balancer
Harry needs to create a system that evenly distributes requests among multiple servers. He's setting up a machine with an algorithm to ensure a balanced allocation of requests across the available servers.
The process of evenly distributing requests among multiple servers is referred to as load balancing, and the machine responsible for this task is known as a load balancer.
Metrics to measure the performance of the system
That concludes this article. In the upcoming articles, we will delve deeper into the concepts of system design.
Senior Software Engineer at Mphasis | Backend Developer | AWS | JavaScript Enthusiast | API Architect |Database design and development.
8moExcellent
ASE @Indiamart | Full Stack Developer | MMMUT '23 | Enthusiastic Learner & Problem Solver
9moGreat work Abhinandan Mishra . Expecting more chapters on this topic 🔥
Specialist Programmer at Infosys | CSE '23
9moVery insightful, waiting for the next one 👍
Associate Software Engineer at Lowe's India | Ex-Intern at MFine, Scaler & CillyFox | Competitive Programmer | App Developer | Flutter | Firebase | Dart | DSA | Node.js | MongoDB | LoopBack3 | CSE 24 @ MMMUT
9moSuperb Articulation, Sir.
AASE @ Accenture
9moVery helpful 😃 Even a newbie like me was able to grasp the concept easily.