扩缩内容驱动型 Web 应用后端
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
扩缩是指增加(或减少)可供后端使用的资源的容量,以提高其性能或可用性。虽然扩缩是后端架构、设计和实现的固有功能,但必须考虑几个重要方面。
此处的性能是指 Web 应用响应请求的速度;这包括延迟时间、速度、吞吐量和资源利用率。
纵向扩缩
纵向扩缩是指增加服务器上的资源。这可能意味着针对基于服务器的架构,将中央应用服务器替换为更强大的机器。对于无服务器、微服务或云端架构,这可能是指升级分配的资源,例如增加可用内存或选择层级更高的虚拟机。
横向扩缩
横向扩缩是指添加更多服务器和并行资源。必须优化底层架构和应用,以处理此类扩缩。例如,在基于服务器的架构中分发请求时,可能需要额外的负载均衡。对于云环境中的无服务器架构(例如 Cloud Functions),可以透明地处理此类扩缩,而无需任何额外配置。
区域扩缩和分布
区域扩缩是指跨多个地理区域分布服务。分发服务或使服务更靠近用户,可以减少延迟并提高应用的整体性能。
请考虑将区域分布和多样性作为架构的一部分,尤其是当您不使用透明地处理这种情况的云服务商时(例如在基于云的无服务器架构中)。考虑应用中的数据存储可能会受到区域分布的影响,尤其是在数据一致性方面。
在全球范围内处理和存储数据时,请注意适用于您系统的任何监管要求或法规,尤其是与数据处理和数据存储相关的法规要求或法规。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eScaling involves adjusting backend resources to enhance performance and availability, encompassing vertical and horizontal approaches as well as regional distribution.\u003c/p\u003e\n"],["\u003cp\u003eVertical scaling focuses on increasing individual server resources, while horizontal scaling adds more servers to distribute the workload.\u003c/p\u003e\n"],["\u003cp\u003eRegional scaling involves distributing services geographically to reduce latency and improve performance, especially for global user bases.\u003c/p\u003e\n"],["\u003cp\u003eData storage considerations are crucial in regional scaling, particularly regarding consistency and regulatory compliance when operating at a global scale.\u003c/p\u003e\n"]]],["Scaling improves backend performance and availability by adjusting resource capacity. Vertical scaling enhances a single server's resources, while horizontal scaling adds more servers. Regional scaling distributes services geographically, reducing latency. Architectures must be optimized for horizontal scaling, possibly requiring load balancing. Cloud-based serverless architectures often manage horizontal and regional scaling automatically. Global data storage requires considering data consistency and regulatory compliance.\n"],null,["# Scale content-driven web app backends\n\nScaling refers to increasing (or decreasing) the capacity of resources available\nto the backend to improve its performance or availability. While scaling is\ninherent to the architecture, design, and implementation of your backend,\nseveral vital aspects must be considered.\n\nPerformance here refers to how quickly the web application can respond to a\nrequest; this includes latency, speed, throughput, and resource utilization.\n\nVertical scaling\n----------------\n\nVertical scaling refers to increasing the resources on a server. This may mean\nreplacing a central application server with a more powerful machine for a\nserver-based architecture. For serverless, microservices, or cloud-based\narchitectures, this may refer to upgrading the allocated resources, such as\nincreasing the available memory or selecting a higher-tier virtual machine.\n\nHorizontal scaling\n------------------\n\nHorizontal scaling refers to the addition of more servers and parallel\nresources. The underlying architecture and the application must be optimized to\nhandle this type of scaling. For example, additional load balancing may be\nneeded to distribute requests in a server-based architecture. For a serverless\narchitecture in a cloud environment, such as [Cloud\nFunctions](https://cloud.google.com/functions), this type of scaling may be\nhandled transparently without any additional configuration.\n\nRegional scaling and distribution\n---------------------------------\n\nRegional scaling refers to distributing services across multiple geographic\nregions. Distributing your services, or moving your services closer to users,\ncan reduce latency and improve the overall performance of your application.\n\nConsider regional distribution and diversity as part of your architecture,\nespecially if you are not using a cloud provider that handles this\ntransparently, such as in a cloud-based serverless architecture. Consider how\n[data storage](/solutions/content-driven/data-storage) in your application may\nbe impacted by regional distribution, especially around data consistency.\n\nWhen processing and storing data at a global scale, be aware of any regulatory\nrequirements or legislation that applies to your system, especially around data\nprocessing and [data\nstorage](/solutions/content-driven/data-storage/regulatory-compliance)."]]