Scalability in System Design | SDE Interview

Ganesh Prasad
4 min readJan 7, 2023

--

In system design, scalability refers to the ability of a system to handle an increasing workload without a decrease in performance. This is important because as a system grows and becomes more popular, it will be required to handle more requests and data. If a system is not designed to scale, it will eventually become overloaded and unable to handle the increased workload, leading to poor performance or outages.

There are several ways to design a system for scalability:

Vertical scaling

In the above diagram, a single server has its resources (CPU, memory, etc.) increased to handle more workload.

Vertical Scaling involves increasing a single server's resources (such as CPU, memory, and storage) to handle more workload. This is a simple and quick way to scale, but it has limits because there is a physical limit to how much you can increase the resources of a single server.

Horizontal scaling:

In the above diagram, the workload is distributed across multiple servers in a cluster.

This involves distributing the workload across multiple servers, also known as a “cluster.” This allows the system to scale beyond the limits of a single server and can handle an almost unlimited amount of workload. However, managing and coordinating the cluster requires more complex infrastructure and additional resources.

Caching:

(source) In the above diagram, frequently accessed data is stored in a cache, reducing the load on the database and improving performance.

Caching involves storing frequently accessed data in memory to retrieve it quickly. This can significantly improve the performance of a system and reduce the load on the database.

Asynchronous processing:

(Source) In the above diagram, task B is performed asynchronously, allowing the main processing thread to continue without waiting for it to complete.

In some cases, it may be possible to design the system to perform specific tasks asynchronously, allowing the main processing threads to continue without waiting for the task to complete. This can improve the overall performance of the system.

Microservices:

In the above diagram, the system is divided into smaller microservices, each handling a specific task.

Instead of building a monolithic system that does everything, creating a system as a set of smaller, independent microservices that each handle a specific task may be more scalable. This allows each microservice to be scaled independently and makes updating and maintaining the system more accessible.

Load balancing:

In the above diagram, a load balancer is used to distribute incoming requests to the servers in the cluster.

If a system is designed to be horizontally scalable, it will likely have multiple servers to distribute the workload. A load balancer is used to distribute incoming requests to the servers in the cluster, ensuring that no single server becomes overloaded.

Database sharding:

If the database is a bottleneck, it may be necessary to “shard” the database, which involves dividing the data into smaller chunks and storing them on separate servers. This allows the database to scale horizontally and handle a larger workload.

                                                ______________
| |
| Sharding |
| Router |
|____________|
|
|
|
+-------------+ +-------------+ | +-------------+
| Shard 1 |-------------------| Shard 2 | | | Shard N |
| | | | | | |
| Database 1 | | Database 2 | | | Database N |
| | | | | | |
+-------------+ +-------------+ | +-------------+

Conclusion

Scalability is essential in system design because it determines how well a system can handle an increasing workload as it grows. By designing a system for scalability, it can ensure that it will continue to perform well as it becomes more popular and attracts more users.

That’s all 👍🏼.

Thanks 🤗.

Want to Hire/Connect? LinkedIn

P.S.: If you like this uninterrupted reading experience on this beautiful platform of Medium.com, consider supporting the writers of this community by signing up for a membership HERE. It only costs $5 per month and helps all the writers.

A clap would be highly appreciated if you liked what you just read. You can be generous in clapping; it shows me how much you enjoyed this story. And if you didn’t like it? Please do comment😋!

--

--

Ganesh Prasad
Ganesh Prasad

Written by Ganesh Prasad

Backend Developer at Appscrip | C++ veteran, 💜 Dart

No responses yet