Database Scaling: Vertical and Horizontal

Database Scaling: Vertical and Horizontal

Watch the video to deepen your understanding.

Subscribe

Complete the full lesson to earn 25 points

Work through each section, then tap “Mark as Complete” on the last one.

Section 1 of 4

✦ Skip the page breaks and see fewer ads — read each lesson on a single page with Pro

Database Scaling: Vertical and Horizontal

As your application grows, the volume of data and the number of concurrent users will inevitably increase. If your database cannot handle this load, your application will suffer from latency, timeouts, and potential downtime. Database scaling is the process of adjusting your database infrastructure to meet these changing demands.

This lesson explores the two primary strategies for scaling relational databases: Vertical Scaling and Horizontal Scaling.


1. Vertical Scaling (Scaling Up)

Vertical scaling, often called "scaling up," involves increasing the capacity of a single existing server. You achieve this by adding more power to the machine—typically by upgrading the CPU, increasing RAM, or adding faster SSD storage.

How it Works

Think of vertical scaling as upgrading a computer. If your database is running on a server with 8GB of RAM and you start hitting memory limits, you swap that server for one with 64GB of RAM.

Practical Example

Imagine an e-commerce platform running on a single PostgreSQL instance. During a flash sale, the CPU usage hits 100% because of complex JOIN queries.

  • The Action: You migrate the database from a db.m5.large instance (2 vCPUs, 8GB RAM) to a db.m5.4xlarge instance (16 vCPUs, 64GB RAM).
  • The Result: The queries execute faster, and the system handles the spike without needing to change your application code.

💡 Key Insight

Vertical scaling is generally the "path of least resistance." It requires no changes to your application logic, database schema, or connection strings.


Section 1 of 4
PrevNext