[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-12-30。"],[[["\u003cp\u003eHorizontal scaling allows workloads in Google Cloud to scale efficiently and maintain performance by adding or removing resources based on demand.\u003c/p\u003e\n"],["\u003cp\u003eUnlike vertical scaling, which has limitations and can be more expensive, horizontal scaling offers virtually unlimited growth potential and can be more cost-effective.\u003c/p\u003e\n"],["\u003cp\u003eTransitioning to a horizontal architecture requires careful planning and utilizing the appropriate tools, such as managed services like Compute Engine MIGs and Cloud Run.\u003c/p\u003e\n"],["\u003cp\u003eEmploying modular design and clear interfaces helps scale components individually, rather than the entire application, and is thus recommended for horizontal scaling.\u003c/p\u003e\n"],["\u003cp\u003eStateless design, where applications do not store data locally, facilitates the addition or removal of instances without data consistency concerns.\u003c/p\u003e\n"]]],[],null,["# Take advantage of horizontal scalability\n\nThis principle in the reliability pillar of the\n[Google Cloud Well-Architected Framework](/architecture/framework)\nprovides recommendations to help you use horizontal scalability. By using\nhorizontal scalability, you can help ensure that your workloads in\nGoogle Cloud can scale efficiently and maintain performance.\n\nThis principle is relevant to the *scoping*\n[focus area](/architecture/framework/reliability#focus-areas)\nof reliability.\n\nPrinciple overview\n------------------\n\nRe-architect your system to a horizontal architecture. To accommodate growth in\ntraffic or data, you can add more resources. You can also remove resources when\nthey're not in use.\n\nTo understand the value of horizontal scaling, consider the limitations of\nvertical scaling.\n\nA common scenario for vertical scaling is to use a MySQL database as the\nprimary database with critical data. As database usage increases, more RAM and\nCPU is required. Eventually, the database reaches the memory limit on the host\nmachine, and needs to be upgraded. This process might need to be repeated\nseveral times. The problem is that there are hard limits on how much a database\ncan grow. VM sizes are not unlimited. The database can reach a point when it's\nno longer possible to add more resources.\n\nEven if resources were unlimited, a large VM can become a single point of\nfailure. Any problem with the primary database VM can cause error responses or\ncause a system-wide outage that affects all users. Avoid single points of\nfailure, as described in\n[Build highly available systems through resource redundancy](/architecture/framework/reliability/build-highly-available-systems).\n\nBesides these scaling limits, vertical scaling tends to be more expensive. The\ncost can increase exponentially as machines with greater amounts of compute\npower and memory are acquired.\n\nHorizontal scaling, by contrast, can cost less. The potential for horizontal\nscaling is virtually unlimited in a system that's designed to scale.\n\nRecommendations\n---------------\n\nTo transition from a single VM architecture to a horizontal multiple-machine\narchitecture, you need to plan carefully and use the right tools. To help you\nachieve horizontal scaling, consider the recommendations in the following\nsubsections.\n\n### Use managed services\n\nManaged services remove the need to manually manage horizontal scaling. For\nexample, with Compute Engine managed instance groups (MIGs), you can add or\nremove VMs to scale your application horizontally. For containerized\napplications, Cloud Run is a serverless platform that can automatically\nscale your stateless containers based on incoming traffic.\n\n### Promote modular design\n\nModular components and clear interfaces help you scale individual components as\nneeded, instead of scaling the entire application. For more information, see\n[Promote modular design](/architecture/framework/performance-optimization/promote-modular-design)\nin the performance optimization pillar.\n\n### Implement a stateless design\n\nDesign applications to be stateless, meaning no locally stored data. This lets\nyou add or remove instances without worrying about data consistency."]]