9.3: Cloud Scalability - Horizontal vs. Vertical Scaling

Introduction to Cloud Computing · LibreTexts

0%

Contents

    Text

    Size
    100%
    Theme
    Typeface
    Line length
    Spacing

    From LibreTexts, under CC BY 4.0, as the source states it; its equations are written in TeX, which the PDF shows typeset. This page at LibreTexts.

    9.3: Cloud Scalability - Horizontal vs. Vertical Scaling

    A major promise of cloud computing is scalability – the ability to handle increasing (or decreasing) workloads by adjusting resources. There are two fundamental strategies: horizontal scaling and vertical scaling. Understanding these is key to implementing a cloud strategy, because how a workload scales influences its cloud architecture.

    • Horizontal Scaling (Scaling Out/In): This means adding more instances of resources to distribute load [2]. Instead of one powerful server, you use multiple servers working in parallel. For example, if an e-commerce website’s traffic doubles, you deploy additional web server instances and use a load balancer to distribute user requests among them. Horizontal scaling often goes hand-in-hand with load balancers – network devices or services that spread traffic across multiple servers to ensure no single instance is overwhelmed. Cloud providers make horizontal scaling straightforward: services like AWS Auto Scaling Groups or Azure VM Scale Sets can automatically launch or terminate instances based on demand. The primary advantages of horizontal scaling are fault tolerance and flexibility: if one node fails, others can take over (improving resilience), and you can adjust capacity granularly by adding or removing instances. Many stateless web applications and modern cloud-native systems leverage horizontal scaling as it also enables near zero-downtime scaling (just add more nodes behind the load balancer). However, horizontal scaling introduces complexity in ensuring data consistency and in balancing load effectively . Applications must be designed to run in a distributed manner, which may involve externalizing state (e.g., using a shared database or cache) and handling communication between nodes.
    • Vertical Scaling (Scaling Up/Down): This approach increases the capacity of a single server or instance – for example, by upgrading its CPU, adding more RAM, or increasing disk throughput. In cloud terms, this could mean switching an instance to a larger instance type (more vCPUs and memory). For instance, moving a workload from a t2.medium VM (2 vCPU, 4GB RAM) to a t2.xlarge (4 vCPU, 16GB RAM) is vertical scaling. The benefit is simplicity: you don’t need to manage multiple nodes or distribute tasks – the application runs on one more powerful machine. Some workloads that are not easily distributed (e.g., certain monolithic databases or applications with in-memory state) might require vertical scaling. Vertical scaling can be cost-effective for moderate growth and avoids the need for complex clustering. However, it has limits – there is usually an upper bound to how big a single machine can get, and scaling beyond that requires significant effort or is impossible. Additionally, vertical scaling often entails downtime (restarting on a new larger VM) and presents a single point of failure (all workload on one machine). Cloud providers support vertical scaling by offering many instance sizes and often allowing online resizing for certain resources (for example, some clouds let you add CPU/memory to a VM with a restart, and cloud databases can be scaled up with minimal downtime).

    It’s important to note that horizontal and vertical scaling are not mutually exclusive – many systems use a combination (diagonal scaling). For example, a database might be vertically scaled to a larger size for more throughput, while web servers scale horizontally. The decision depends on the application architecture and goals. Generally, cloud strategies encourage horizontal scaling for front-end and stateless services (due to its elasticity and resilience), and careful vertical scaling for stateful or legacy components that cannot distribute load.
    Horizontal vs. Vertical Scaling Compared. Details in caption.

    Figure \(\PageIndex{1}\): Horizontal vs. Vertical Scaling Compared. This conceptual illustration contrasts scaling out (adding more instances behind a load balancer) with scaling up (upgrading a single instance to a larger size), highlighting the trade-offs of each approach. (CC BY 4.0; Felix Amoruwa) Access to a detailed description of Figure \(\PageIndex{1}\)

    Load Balancers play a crucial role in horizontal scaling. They come in different types, commonly categorized by the OSI layer at which they operate:

    • Layer 4 Load Balancers (Transport Layer): These route traffic based on IP addresses and ports without inspecting the content of the packets. A layer 4 load balancer simply sees that a new TCP connection or UDP datagram arrived, and it decides which backend server to send it to, using algorithms like round-robin or least connections. This approach is fast and efficient for raw distribution of network traffic, suitable for scenarios like balancing simple web requests or streaming traffic.
    • Layer 7 Load Balancers (Application Layer): These operate at the application protocol level (e.g., HTTP/HTTPS). A layer 7 load balancer can inspect the content of the requests – such as URLs, HTTP headers, or cookies – and make smarter routing decisions. For instance, it could direct requests for /images/ to one set of servers and /api/ to another. Layer 7 load balancers enable advanced features like content-based routing, SSL termination, and application-specific health checks. They are ideal for web applications and microservices, where you might want to route traffic based on context or implement A/B testing and blue-green deployments.
    Layer 4 vs Layer 7 Load Balancing. Details in caption.
    Figure \(\PageIndex{2}\): Layer 4 vs. Layer 7 Load Balancing. This diagram illustrates how Layer 4 load balancers route traffic based on IP and port information, while Layer 7 load balancers inspect application-level content such as URLs and headers to make routing decisions. (CC BY 4.0; Felix Amoruwa) Access to a detailed description of Figure \(\PageIndex{1}\)

    Cloud providers offer managed load balancers at both layers: for example, AWS provides the Classic and Network Load Balancers (primarily layer 4) and the Application Load Balancer (layer 7), while Azure has Load Balancer (layer 4) and Application Gateway (layer 7), and Google Cloud has similar services. When implementing your strategy, you choose the type of load balancer that fits your workload – sometimes you even use both (e.g., a layer 4 load balancer for lower-level TCP traffic like database clustering, and a layer 7 balancer for web traffic).

    In summary, scalability planning for implementation means deciding if and how a workload will scale in the cloud. The choice between horizontal vs vertical (or a mix) affects everything from the instance types chosen to the network architecture (need for load balancers, clustering, etc.). A cloud strategy must explicitly consider this so that during implementation, the team sets up the correct scaling mechanisms. A failure to align scaling strategy with the workload can lead to either under-provisioning (poor performance) or over-provisioning (wasted cost), both of which undercut the benefits of cloud.


    This page titled 9.3: Cloud Scalability - Horizontal vs. Vertical Scaling was last modified on Tue, 22 Sep 2026 21:13:29 GMT and is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Felix Amoruwa.