Take advantage of horizontal scalability Stay organized with collections Save and categorize content based on your preferences.
This principle in the reliability pillar of theGoogle Cloud Well-Architected Framework provides recommendations to help you use horizontal scalability. By usinghorizontal scalability, you can help ensure that your workloads inGoogle Cloud can scale efficiently and maintain performance.
This principle is relevant to thescopingfocus area of reliability.
Principle overview
Re-architect your system to a horizontal architecture. To accommodate growth intraffic or data, you can add more resources. You can also remove resources whenthey're not in use.
To understand the value of horizontal scaling, consider the limitations ofvertical scaling.
A common scenario for vertical scaling is to use a MySQL database as theprimary database with critical data. As database usage increases, more RAM andCPU is required. Eventually, the database reaches the memory limit on the hostmachine, and needs to be upgraded. This process might need to be repeatedseveral times. The problem is that there are hard limits on how much a databasecan grow. VM sizes are not unlimited. The database can reach a point when it'sno longer possible to add more resources.
Even if resources were unlimited, a large VM can become a single point offailure. Any problem with the primary database VM can cause error responses orcause a system-wide outage that affects all users. Avoid single points offailure, as described inBuild highly available systems through resource redundancy.
Besides these scaling limits, vertical scaling tends to be more expensive. Thecost can increase exponentially as machines with greater amounts of computepower and memory are acquired.
Horizontal scaling, by contrast, can cost less. The potential for horizontalscaling is virtually unlimited in a system that's designed to scale.
Recommendations
To transition from a single VM architecture to a horizontal multiple-machinearchitecture, you need to plan carefully and use the right tools. To help youachieve horizontal scaling, consider the recommendations in the followingsubsections.
Use managed services
Managed services remove the need to manually manage horizontal scaling. Forexample, with Compute Engine managed instance groups (MIGs), you can add orremove VMs to scale your application horizontally. For containerizedapplications, Cloud Run is a serverless platform that can automaticallyscale your stateless containers based on incoming traffic.
Promote modular design
Modular components and clear interfaces help you scale individual components asneeded, instead of scaling the entire application. For more information, seePromote modular design in the performance optimization pillar.
Implement a stateless design
Design applications to be stateless, meaning no locally stored data. This letsyou add or remove instances without worrying about data consistency.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-30 UTC.