Day-3
How to do Vertical Scaling ?
What is Vertical Scaling?
Vertical scaling, often referred to as "scaling up," means increasing the capacity of an application or database by adding more power to a single existing machine
Core Architecture of a Vertically Scaled System
In system design, a vertically scaled architecture typically centers around a monolithic application or a centralized, single-database setup
Key Hardware Upgrades:
CPU: Upgrading to processors with more cores and higher clock speeds allows the system to efficiently execute CPU-bound tasks, such as complex algorithms, cryptographic encryption, and concurrent request processing
. RAM: Increasing volatile memory capacity enables larger in-memory databases (e.g., Redis), accommodates massive application caches, and permits more simultaneous threads to run without swapping data to the slower disk
. Storage (I/O): Migrating from traditional HDDs to high-speed NVMe SSDs or configuring redundant RAID arrays dramatically boosts Input/Output Operations Per Second (IOPS), which is essential for database-heavy workloads
. Network: Upgrading to high-throughput 10Gbps or 40Gbps Network Interface Cards (NICs) ensures that network bandwidth does not become a bottleneck for data transfer
.
Software Optimization for Vertical Scaling
Simply purchasing and installing massive hardware is not enough
Tuning the Application Layer
Multi-threading and Concurrency: Application servers (such as Tomcat, Gunicorn, or Node.js in cluster mode) must be configured to utilize all available CPU cores
. If an application remains strictly single-threaded, a high-end 64-core machine is fundamentally wasted . Connection Pooling: Database connection pools (like HikariCP) need to be scaled up proportionally
. This allows the application to execute a higher volume of simultaneous database queries, utilizing the extra RAM and CPU cycles . Memory Management: Garbage collection (GC) parameters and runtime settings (such as the JVM heap size) must be carefully tuned
. Larger memory pools require optimized GC algorithms to prevent massive, system-wide "stop-the-world" pauses .
Tuning the Database Layer
Buffer Pool Size: For relational databases like MySQL utilizing the InnoDB engine, configuration parameters like
innodb_buffer_pool_sizeshould be increased to occupy roughly 70-80% of the newly added RAM. This ensures that the majority of data reads occur directly from memory rather than hitting the disk . Indexing: Maintaining and optimizing proper indexes is critical to maximizing the lookup and query processing efficiency of the upgraded hardware
.
Advantages of Vertical Scaling
Simplicity: It requires minimal to zero architectural or structural changes to the application logic
. Developers do not have to manage the inherent complexities of distributed systems, such as data sharding, network partitions, or complex load-balancing rules . Strict Data Consistency: Because all data resides on a single machine, maintaining absolute ACID compliance, transactions, and relational integrity remains straightforward and uncompromised
. Ultra-Low Latency: Data processing and complex database joins occur locally within the same system, entirely eliminating the inter-server network latency common in distributed setups
.
The Hard Limits and Disadvantages
Vertical scaling is rarely a permanent solution for hyper-growth systems due to several restrictive thresholds
The Hardware Ceiling: There is a definitive physical limit to hardware engineering
. You cannot purchase a single machine with infinite RAM, storage space, or CPU cores . Cost Inefficiency: Upgrading a single machine scales costs exponentially rather than linearly
. For instance, a single enterprise server equipped with 2TB of RAM is significantly more expensive than purchasing four separate, standard servers with 512GB of RAM each . Single Point of Failure (SPOF): Running your entire system on one massively scaled machine introduces severe risk
. If that single server experiences a hardware failure, power loss, or operating system crash, the entire application suffers an immediate and complete outage because there is no built-in high availability .
When to Choose Vertical Scaling
Vertical scaling is highly effective for early-stage startups, low-to-medium traffic platforms, or applications dependent on heavy, highly consistent relational databases
Aws Aurora
Amazon Aurora is a modern, cloud-native relational database service created by AWS
The magic of Aurora is that it gives you the best of both worlds: the speed and reliability of high-end commercial databases, combined with the simplicity and low cost of open-source databases
The Core Architecture: Splitting the "Brain" from the "Muscle"
In a traditional database setup, a single server houses both the Compute (the CPU/RAM that processes queries) and the Storage (the hard drive where data sits)
Aurora fixes this by completely decoupling these two layers
The Compute Layer (The "Brain"): This layer consists of database instances that handle incoming user requests, process SQL queries, and manage transactions
. The Storage Layer (The "Muscle"): Instead of storing data on the local hard drive of the compute instance, Aurora uses a shared, virtualized storage fleet built specifically for the cloud
.
How Aurora Destroys the "Database Ceiling"
When a traditional database runs out of disk space or processor power, it stops working
1. Auto-Scaling Storage
You never have to provision or guess how much disk space you need ahead of time. The storage layer automatically detects when you are running low on space and expands seamlessly in 10GB increments up to 128 TiB
2. Self-Healing, Six-Way Replication
Every piece of data you write to Aurora is automatically duplicated 6 times across 3 different physical locations (Availability Zones)
3. Instant, Low-Latency Read Replicas
You can connect up to 15 "Read Replicas" (copycat databases) to handle high viewer traffic
Key Benefits in Plain English
Operational Simplicity: Programmers don't have to manually chop up data tables (sharding) or manage complex server infrastructure
. Aurora acts like a standard single database, but handles the scaling under the hood . High Availability: Because data is heavily replicated and failures are handled automatically, your app experiences almost no downtime
. Strict Consistency: It fully supports ACID transactions, ensuring your data (like banking records or order histories) is always accurate and never corrupted
.