When a system is large, the data in the system is bound to be large. And over time, the data is increased continuously which makes it difficult to manage. With the intention of good data management in the system, the resources are maintained. Let’s see an example of an e-commerce app that sells organic foods only. Earlier, when people were not aware of the benefits of organic foods, the app was rarely used but with time, people began realizing the importance of the food and the app started becoming famous. The app began receiving huge traffic to the point where it feels like it’s losing functionality. The solution to this issue is adding infrastructures in the app so that the functionality increases to handle the load. This is called Scaling.
The formal definition of scaling is the ability to add or remove resources to accommodate the increasing or decreasing demand of operations. The point where the requests for the operation in the system reach their limit is known as the scalability limit.
Types of scaling
There are two types of scaling: -
Vertical Scaling
Horizontal Scaling
Vertical Scaling
The first kind of scaling is vertical where we upgrade the existing machine to improve the application capability. This can be done by increasing hardware capacity, i.e., additional CPU, memory, and disc space. The general infrastructure and the design of the app remain the same.
We can also address Vertical Scaling as Scaling up. The most common examples are MySQL and Amazon RDS. It is typically used in small and mid-sized companies.
Pros of vertical scaling
Simple Implementation process
Easier to manage
Data consistency
No data-partitioning
Less administrative effort
Lessened software costs
Less power consumption
Maintained application compatibility.
Cons of vertical scaling
Replacing or upgrading the server takes time which results in high downtime.
Hardware failures and outages are highly possible
Future upgradeability has a limited scope.
Implementation cost is very expensive.
Limited scaling
The potential for network I/O or disk I/O is limited.
Horizontal scaling
Unlike vertical scaling, we add machines to the system instead of upgrading the already existing ones. This helps to distribute the load (load balancing) which ultimately improves the system’s performance. If availability is the highest priority for your system, then horizontal scaling is your go-to add-in. In addition, it has an advantage over vertical scaling on downtime since the load is distributed.
This is also known as the scale-out approach. Load Balancing is very effectively used by increasing I/O concurrency, reducing the load on existing nodes.
Pros of horizontal scaling
Redundancy increment
Better Fault Tolerance
Flexible and Efficient
Easily Upgradeable
More efficient utilization of smaller systems.
Enhanced resilience with multiple systems
Lower downtime when compared with vertical scaling
Cons of horizontal scaling
Architectural designs are complicated
Data partitioning is required.
Big impact on data centers
Additional networking pieces of equipment are required. (Switches, Routers, etc.)
Utility cost is high (cooling and electricity)
Licensing fees are expensive
Data inconsistency
Downstream services have increased loads.
Difference between vertical and horizontal scaling
S.N. | Vertical Scaling | Horizontal Scaling |
---|---|---|
1. | Load Balancing is not required. | Load Balancing is required. |
2. | Single Point of failure. | Resilient to system failure. |
3. | Inter-process communication. | Utilizes netowrk calls. |
4. | Data Consistency | Data Inconsistency |
5. | Hardware Limit | Scales well |
6. | Increased downtime | Lest downtime |
7. | Data partitioning doesn't happen. | Data partitioning happens. |
How to choose between Vertical and Horizontal scaling
1. Performance
Horizontal scaling opens your horizon with multiple machines which enhances the performance.
2. Redundancy
Horizontal scaling has built-in redundancy.
3. Flexibility
Horizontal scaling is preferable if you want flexibility in your system.
4. Regularity of upgrades
Since vertical scaling limits your upgrading limits, horizontal is more upgradeable.
5. Geographical distribution
If you want to distribute your data in the system according to geographical location to reduce latency and comply with regulatory standards or to handle disaster recovery scenarios, horizontal scaling is a good option rather than having a single node in vertical scaling.
6. Cost
If your system requirement can be handled in a single node with consistent data, vertical scaling might save you money.
Conclusion
There might be a debate while choosing between horizontal and vertical scaling and the better idea would be having the option for both. Microservices architectures have more important features to discuss than scalability but if horizontal scalability is added, it can have better capacity elasticity than monolithic architectures.
However, the most efficient advantage will be obtained when both vertical scalability and horizontal scalability are available.
pragyaasapkota / System-Design-Concepts
A repo with some system design concepts.
System Design
Systems design is the process of defining elements of a system like modules, architecture, components and their interfaces and data for a system based on the specified requirements.
This is a index for the concepts of system.
If you wish to open these in a new tab, Press CTRL+click
S.N. | Table of Content |
---|---|
1. | Caching |
2. | Network Protocols |
3. | Storage: The Underrated Topic |
4. | Latency and Throughput |
5. | System Availability |
6. | Leader Election |
7. | Proxies |
8. | Load Balancing |
9. | Endpoint Protection |
10. | HTTPS: Is it better than HTTP? |
11. | Polling and Streaming |
12. | Long Polling |
13. | Hashing |
14. | CAP Theorem |
15. | PACELC Theorem |
16. | Messaging and Pub-Sub |
17. | Database |
18. | Logging, Monitoring, and Alerting |
19. | Distributed System |
20. | Scaling |
21. | Event Driven Architecture (EDA) |
Thank you!!!
I hope this article was helpful to you.
Please don’t forget to follow me!!!
Any kind of feedback or comment is welcome!!!
Thank you for your time and support!!!!
Keep Reading!! Keep Learning!!!
Top comments (0)