全局缩放预配的吞吐量Globally scale provisioned throughput

在 Azure Cosmos DB 中,预配吞吐量以“请求单位数/秒 (RU/s 或复数形式 RUs)”表示。In Azure Cosmos DB, provisioned throughput is represented as request units/second (RU/s or the plural form RUs). RU 度量针对 Cosmos 容器执行的读取和写入操作的成本,如下图所示:RUs measure the cost of both read and write operations against your Cosmos container as shown in the following image:

请求单位

可以针对 Cosmos 容器或 Cosmos 数据库预配 RU。You can provision RUs on a Cosmos container or a Cosmos database. 针对容器预配的 RU 专门适用于针对该容器执行的操作。RUs provisioned on a container are exclusively available for the operations performed on that container. 针对数据库预配的 RU 在该数据库中的所有容器之间共享(具有专用分配 RU 的任何容器除外)RUs provisioned on a database are shared among all the containers within that database (except for any containers with exclusively assigned RUs).

若要弹性缩放预配的吞吐量,随时可以增大或减小预配的 RU/秒。For elastically scaling provisioned throughput, you can increase or decrease the provisioned RU/s at any time. 有关详细信息,请参阅“如何预配吞吐量和弹性缩放 Cosmos 容器与数据库”。For more information, see How-to provision throughput and to elastically scale Cosmos containers and databases. 若要多区域缩放吞吐量,随时可以在 Cosmos 帐户中添加或删除区域。For multiple-regionally scaling throughput, you can add or remove regions from your Cosmos account at any time. 有关详细信息,请参阅在数据库帐户中添加/删除区域For more information, see Add/remove regions from your database account. 在许多情况下,将多个区域与 Cosmos 帐户关联非常重要,这样可以在全中国实现低延迟和高可用性Associating multiple regions with a Cosmos account is important in many scenarios - to achieve low latency and high availability around China.

预配的吞吐量是如何跨区域分布的How provisioned throughput is distributed across regions

如果针对 Cosmos 容器(或数据库)预配了 'R' 个 RU,则 Cosmos DB 可确保 'R' 个 RU 在与 Cosmos 帐户关联的每个区域中都可用。 If you provision 'R' RUs on a Cosmos container (or database), Cosmos DB ensures that 'R' RUs are available in each region associated with your Cosmos account. 每次将新区域添加到帐户时,Cosmos DB 都会自动在新添加的区域中预配 'R' 个 RU 。Each time you add a new region to your account, Cosmos DB automatically provisions 'R' RUs in the newly added region. 保证针对 Cosmos 容器执行的操作可以在每个区域中获取 'R' 个 RU 。The operations performed against your Cosmos container are guaranteed to get 'R' RUs in each region. 无法有选择地将 RU 分配给特定区域。You can't selectively assign RUs to a specific region. 针对 Cosmos 容器(或数据库)预配的 RU 是在与 Cosmos 帐户关联的所有区域中预配的。The RUs provisioned on a Cosmos container (or database) are provisioned in all the regions associated with your Cosmos account.

假设为 Cosmos 容器配置了 'R' 个 RU,并且有 'N' 个区域与 Cosmos 帐户关联,那么:Assuming that a Cosmos container is configured with 'R' RUs and there are 'N' regions associated with the Cosmos account, then:

  • 如果为 Cosmos 帐户配置了单个写入区域,则容器中多区域可用的 RU 总数 = R x N 。If the Cosmos account is configured with a single write region, the total RUs available multiple-regionally on the container = R x N.

  • 如果为 Cosmos 帐户配置了多个写入区域,则容器中多区域可用的 RU 总数 = R x (N +1)。If the Cosmos account is configured with multiple write regions, the total RUs available multiple-regionally on the container = R x (N+1). 将自动预配附加的 R 个 RU,以处理区域之间的更新冲突和反熵流量。The additional R RUs are automatically provisioned to process update conflicts and anti-entropy traffic across the regions.

所选的一致性模型也会影响吞吐量。Your choice of consistency model also affects the throughput. 与更强的一致性级别(例如,“有限过期” 或“强” 一致性)相比,更宽松的一致性级别(例如“会话” 、“一致前缀” 和“最终” 一致性)可以获得约 2 倍的读取吞吐量。You can get approximately 2x read throughput for the more relaxed consistency levels (e.g., session, consistent prefix and eventual consistency) compared to stronger consistency levels (e.g., bounded staleness or strong consistency).

后续步骤Next steps

接下来,可以了解如何在容器或数据库上配置吞吐量:Next you can learn how to configure throughput on a container or database: