Creating and designing an application that can sustain and carry forward operations for millions of users is challenging and it is also a path that required continuous support and improvement. Having knowledge of designing an efficient system that can support millions of users is very important and can only be implemented if the developer has a great understanding of system design.
In this blog, we will discuss the importance and a few concepts that developers should know before starting a journey to learn system design.
What is System Design?
If you case studies any software like Facebook, Gmail, Instagram, or Twitter, you will be able to understand the advancements we have achieved in the last decades. Across the globe, billions of people use these apps concurrently, each making thousands of different types of requests at the same time.
This development has totally changed how we design and develop any application, as a developer you have to choose and apply the correct techniques so that your application can handle this huge amount of traffic and data.
Thus, this is where the concept of System Design is applied. As you progress and gain experience, as a developer, it will be expected of you to handle all the complicated software design problems and understand the bigger picture about the working of application and development.
Also read, Simple Explanation of Sorting Algorithms with JavaScript | Part 2
Essential Concepts in System Design
Before moving forward to study an application system design, we need to have a sound knowledge of a few important system design fundamentals, so that we can deeply understand the concepts of how we can scale an application and concurrently handle millions of users.
Scalability:- Horizontal and vertical scaling
The scalability of an application refers to the application’s capability to handle the increased number of requests and withstand huge traffic without compromising latency.
Horizontal scaling refers to adding more hardware to the already existing hardware pool of the application. It helps in increasing more computational power of the system.
Vertical scaling refers to adding more power to your server. It helps in increasing more power of the hardware running the application.
Latency & Throughput
Latency and throughput are two important factors when you want to understand an application’s performance. Latency is referred to the total time required to perform an action or produce a result. For example, if a user searches a file, then the time is taken to reach the searched query to your server and the search result back to the user is known as Latency.
Throughput is referred to the number of requests or actions executed per unit of time, in order to make your system perform better than you should focus on maximum throughput with minimum or acceptable latency.
Also read, Where Non-Techies Can Get With the Programming
Cap Theorem
The Cap theorem is a fundamental theorem of system design, which states that a distributed system (a system with multiple interconnected components that may be located at different machines and share the same data) can only have any two of three properties simultaneously – consistency, availability, and partition tolerance.
Consistency
In a consistent system, all components connected share the same data simultaneously. If you perform a read operation on a consistent system then it should return the most recent write operation.
Availability
Availability in a consistent system is said when the system is operational all the time even if the multiple components are down at the same time. All the requests from clients get executed and the result is produced even if a few servers are down as most components share the same data.
Partition Tolerance
When a network between any two components breaks in a distributed system but the system remains operational, it is known as Partition Tolerance. In order to have Partition Tolerance then you need to keep a copy of system records across all the components even if the communication between the components breaks but the system does not break.
Content Delivery Network
Content Delivery Network also known as CDN is a popular and modern way of reducing request latency by fetching the static data from different servers instead of keeping it to its own application server, in that way
It is an approach of distributing generally large chunks of files like HD images, videos, or HTML/CSS/JS on a group of composed servers spread out globally in such a way that even the users are far away from their own application server but can quickly fetch it through CDN.
Also read, How does JavaScript works? A detail explanation of JavaScript’s Engine Working
Load Balancers
Load Balancing is very important when it comes to scaling an application. It helps to distribute performance equally while keeping minimum latency when traffic increases exponentially.
Load Balancer is a device that is responsible for equally distributing traffic across users while keeping a smooth experience for all concurrent users. A well-balanced and evenly distributed load means that each server can equally provide better services to each user.
Microservices
Microservices are said to have an architectural style in which the system is created with different modular services which are governed, deployed, and maintained independently.
In this architectural style, maintaining and updating the different types of services is much faster and more reliable than working with a monolithic architecture.
Also read, How Does React Js works | Detail Explanation on Virtual DOM
Databases
Setting up a database according to data and use is also very important when you scale your application. When choosing the correct database for your application factors like speed and accuracy play a very important role.
A relational database provides data accuracy while a Non-relational database guarantees data consistency.
Caching
Caching your hardware or software is very essential when you want to increase your application performance tremendously. When users access some data the application saves a small amount of data in the user’s system (like saving website data in the browser), so when the next time the user accesses the same data again then he would be able to access it very quickly than before.
Caches are generally very small which makes them efficient and cost-effective. Accessing cache data is a lot faster than again from the server or main memory.
Message Queues
A message queue is a technique to order the data while sending it from the server to users. It follows FIFO (First In First Out) method which determines that the message which has been sent first then it will be received first by the user.
Message queue enables the asynchronous feature in the system which does not hinder the primary task even if the current task given by the user is taking some time to execute.
Also read, Simple Explanation on BFS and DFS Graph Traversal Methods
Final Words
As you progress in your software career and start to apply for bigger roles then system design will play a very important role along with data structure and applications.
Because of its increasing importance and popularity, I am starting a series of “Mastering System Design 101”. Please share more with your friends and colleagues if you like this article and do check out more articles on DSA, JavaScript, React, and Programming.