您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

使用 Azure Cosmos DB 预留容量优化成本Optimize cost with reserved capacity in Azure Cosmos DB

适用于: SQL API Cassandra API Gremlin API 表 API Azure Cosmos DB API for MongoDB

Azure Cosmos DB 预留容量可通过预付为期一年或三年的 Azure Cosmos DB 资源预留费用为你省钱。Azure Cosmos DB reserved capacity helps you save money by committing to a reservation for Azure Cosmos DB resources for either one year or three years. 使用 Azure Cosmos DB 预留容量,可以获得为 Cosmos DB 资源预配的吞吐量的折扣。With Azure Cosmos DB reserved capacity, you can get a discount on the throughput provisioned for Cosmos DB resources. 资源示例包括数据库和容器(表、集合和图)。Examples of resources are databases and containers (tables, collections, and graphs).

Azure Cosmos DB 预留容量可以大幅降低 Cosmos DB 成本,相比正常价格最多可以降低 65%,前提是提前承诺使用一年或三年的服务。Azure Cosmos DB reserved capacity can significantly reduce your Cosmos DB costs—up to 65 percent on regular prices with a one-year or three-year upfront commitment. 预留容量提供一种计费折扣,并且不会影响 Azure Cosmos DB 资源的运行时状态。Reserved capacity provides a billing discount and doesn't affect the runtime state of your Azure Cosmos DB resources.

Azure Cosmos DB 预留容量涵盖为资源预配的吞吐量的费用。Azure Cosmos DB reserved capacity covers throughput provisioned for your resources. 但它不涵盖存储和网络费用。It doesn't cover the storage and networking charges. 购买预留后,不再像即用即付资费一样收取与预留属性相应的吞吐量费用。As soon as you buy a reservation, the throughput charges that match the reservation attributes are no longer charged at the pay-as-you go rates. 预留相关详细信息,请参阅 Azure 预留一文。For more information on reservations, see the Azure reservations article.

可从 Azure 门户购买 Azure Cosmos DB 预留容量。You can buy Azure Cosmos DB reserved capacity from the Azure portal. 通过提前付款或按月付款的方式为预留付款。Pay for the reservation up front or with monthly payments. 购买预留容量:To buy reserved capacity:

  • 对于至少一个企业或个人订阅,你必须以即用即付费率作为所有者角色。You must be in the Owner role for at least one Enterprise or individual subscription with pay-as-you-go rates.
  • 对于企业订阅,必须在 EA 门户中启用“添加预留实例”。For Enterprise subscriptions, Add Reserved Instances must be enabled in the EA portal. 或者,如果禁用了该设置,则必须是订阅的 EA 管理员。Or, if that setting is disabled, you must be an EA Admin on the subscription.
  • 对于云解决方案提供商 (CSP) 计划,只有管理员代理或销售代理可以购买 Azure Cosmos DB 预留容量。For the Cloud Solution Provider (CSP) program, only admin agents or sales agents can buy Azure Cosmos DB reserved capacity.

在购买之前确定所需吞吐量Determine the required throughput before purchase

保留容量购买的大小应基于现有或即将部署 Azure Cosmos DB 资源每小时将使用的总吞吐量量(以小时为单位)。The size of the reserved capacity purchase should be based on the total amount of throughput that the existing or soon-to-be-deployed Azure Cosmos DB resources will use on an hourly basis. 例如:购买 30000 RU/s 保留容量(如果这是你的每小时使用模式)。For example: Purchase 30,000 RU/s reserved capacity if that's your consistent hourly usage pattern. 在此示例中,将使用即用即付费率对超过 30000 RU/s 的任何预配吞吐量进行计费。In this example, any provisioned throughput above 30,000 RU/s will be billed using your Pay-as-you-go rate. 如果在一小时内预配的吞吐量低于 30000 RU/秒,则该小时的额外预留容量将会浪费。If provisioned throughput is below 30,000 RU/s in an hour, then the extra reserved capacity for that hour will be wasted.

我们根据你的每小时使用情况模式计算购买建议。We calculate purchase recommendations based on your hourly usage pattern. 会分析过去7、30和60天的使用情况,并购买保留容量购买,建议你节省费用。Usage over last 7, 30 and 60 days is analyzed, and reserved capacity purchase that maximizes your savings is recommended. 您可以使用以下步骤在 Azure 门户中查看推荐的保留大小:You can view recommended reservation sizes in the Azure portal using the following steps:

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 选择 "所有服务 > 保留" " > 添加"。Select All services > Reservations > Add.

  3. 从 " 购买预订 " 窗格中选择 " Azure Cosmos DB"。From the Purchase reservations pane, choose Azure Cosmos DB.

  4. 选择 " 建议 " 选项卡以查看建议的保留:Select the Recommended tab to view recommended reservations:

可以按以下属性筛选建议:You can filter recommendations by the following attributes:

  • 条款 (1 年或3年) Term (1 year or 3 years)
  • 计费频率 (每月或前) Billing frequency (Monthly or Upfront)
  • 吞吐量类型 (RU/s 与多区域写入 RU/秒) Throughput Type (RU/s vs multi-region write RU/s)

此外,你可以将建议范围限定在单个资源组、单个订阅或整个 Azure 注册中。Additionally, you can scope recommendations to be within a single resource group, single subscription, or your entire Azure enrollment.

下面是一个示例建议:Here's an example recommendation:

保留的容量建议

这种购买 30000 RU/秒预订的建议表明,在3年的保留期,30000 RU/秒预留大小将最大限度地节省费用。This recommendation to purchase a 30,000 RU/s reservation indicates that, among 3 year reservations, a 30,000 RU/s reservation size will maximize savings. 在这种情况下,将根据 Azure Cosmos DB 使用量过去的30天来计算建议。In this case, the recommendation is calculated based on the past 30 days of Azure Cosmos DB usage. 如果此客户预计过去30天的 Azure Cosmos DB 使用量代表将来使用,则可以通过购买 30000 RU/s 预订来最大限度地节省成本。If this customer expects that the past 30 days of Azure Cosmos DB usage is representative of future use, they would maximize savings by purchasing a 30,000 RU/s reservation.

购买 Azure Cosmos DB 预留容量Buy Azure Cosmos DB reserved capacity

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 选择 "所有服务 > 保留" " > 添加"。Select All services > Reservations > Add.

  3. 从 " 采购预订 " 窗格中,选择 " Azure Cosmos DB " 以购买新预订。From the Purchase reservations pane, choose Azure Cosmos DB to buy a new reservation.

  4. 填写必填字段,如下表所示:Fill in the required fields as described in the following table:

    填写预留容量表

    字段Field 说明Description
    作用域Scope 控制有多少订阅可以使用与预留关联的计费权益的选项。Option that controls how many subscriptions can use the billing benefit associated with the reservation. 它还控制将预留应用于特定订阅的方式。It also controls how the reservation is applied to specific subscriptions.

    如果选择“共享”,预留折扣将应用到计费上下文内任何订阅中运行的 Azure Cosmos DB 实例。If you select Shared, the reservation discount is applied to Azure Cosmos DB instances that run in any subscription within your billing context. 计费上下文基于 Azure 的注册方式。The billing context is based on how you signed up for Azure. 对于企业客户,共享范围是注册范围,包括注册中的所有订阅。For enterprise customers, the shared scope is the enrollment and includes all subscriptions within the enrollment. 对于即用即付客户,共享范围是由帐户管理员创建的即用即付费率的所有订阅。For pay-as-you-go customers, the shared scope is all individual subscriptions with pay-as-you-go rates created by the account administrator.

    如果选择“单个订阅”,预留折扣将应用到所选订阅中的 Azure Cosmos DB 实例。If you select Single subscription, the reservation discount is applied to Azure Cosmos DB instances in the selected subscription.

    如果选择 " 单个资源组",则预订折扣将应用于所选订阅中的 Azure Cosmos DB 实例和该订阅内的所选资源组。If you select Single resource group, the reservation discount is applied to Azure Cosmos DB instances in the selected subscription and the selected resource group within that subscription.

    购买预留容量后,可以更改预留范围。You can change the reservation scope after you buy the reserved capacity.
    订阅Subscription 用于支付 Azure Cosmos DB 预留容量费用的订阅。Subscription that's used to pay for the Azure Cosmos DB reserved capacity. 所选订阅的付款方式用于对成本进行收费。The payment method on the selected subscription is used in charging the costs. 订阅必须是以下类型之一:The subscription must be one of the following types:

    企业协议 (产品/服务: BC-OP-NT-AZR-Ms-azr-0017p 或 BC-OP-NT-AZR-Ms-azr-0148p) :对于企业订阅,将从注册的 Azure 预付款中扣除费用, (之前称为货币承诺) 余额,或者作为超额费用收费。Enterprise Agreement (offer numbers: MS-AZR-0017P or MS-AZR-0148P): For an Enterprise subscription, the charges are deducted from the enrollment's Azure Prepayment (previously called monetary commitment) balance or charged as overage.

    使用即用即付费率的单个订阅 (产品/服务: BC-OP-NT-AZR-Ms-azr-0003p 或 BC-OP-NT-AZR-0023P) :对于使用即用即付费率的单个订阅,将对订阅上的信用卡或发票付款方式收取费用。Individual subscription with pay-as-you-go rates (offer numbers: MS-AZR-0003P or MS-AZR-0023P): For an individual subscription with pay-as-you-go rates, the charges are billed to the credit card or invoice payment method on the subscription.
    资源组Resource Group 将保留的容量折扣应用到的资源组。Resource group to which the reserved capacity discount is applied.
    术语Term 一年或三年。One year or three years.
    吞吐量类型Throughput Type 吞吐量设置为 "请求单位"。Throughput is provisioned as request units. 你可以为设置-单区域写入和多个区域写入购买预配吞吐量的预留。You can buy a reservation for the provisioned throughput for both setups - single region writes as well as multiple region writes. 吞吐量类型有两个值可供选择:每小时 100 RU/秒,100多区域每小时写入 RU/秒。The throughput type has two values to choose from: 100 RU/s per hour and 100 multi-region writes RU/s per hour.
    保留容量单位Reserved Capacity Units 想预留的吞吐量的量。The amount of throughput that you want to reserve. 可以通过确定每个区域的所有 Cosmos DB 资源(例如,数据库或容器)所需的吞吐量来计算此值。You can calculate this value by determining the throughput needed for all your Cosmos DB resources (for example, databases or containers) per region. 然后,将其与 Cosmos 数据库关联的区域数相乘。You then multiply it by the number of regions that you'll associate with your Cosmos database. 例如:如果有五个区域,每个区域 1 百万 RU/秒,则购买预留容量时应选 5 百万 RU/秒。For example: If you have five regions with 1 million RU/sec in every region, select 5 million RU/sec for the reservation capacity purchase.
  5. 填写该表单后,将计算购买保留容量所需的价格。After you fill the form, the price required to purchase the reserved capacity is calculated. 输出还会显示所选选项的折扣百分比。The output also shows the percentage of discount you get with the chosen options. 下一步单击 选择Next click Select

  6. 在 " 购买预订 " 窗格中,查看预订的折扣和价格。In the Purchase reservations pane, review the discount and the price of the reservation. 此预留价格适用于使用跨所有区域预配的吞吐量的 Azure Cosmos DB 资源。This reservation price applies to Azure Cosmos DB resources with throughput provisioned across all regions.

    保留的容量摘要

  7. 选择 " 查看 " 和 " 立即购买"。Select Review + buy and then buy now. 购买成功后,会看到如下页面所示内容:You see the following page when the purchase is successful:

购买预留后,它立即应用到与预留期相符的所有现有 Azure Cosmos DB 资源。After you buy a reservation, it's applied immediately to any existing Azure Cosmos DB resources that match the terms of the reservation. 如果还没有 Azure Cosmos DB 资源,则将在你部署符合预留期的新 Cosmos DB 实例时应用预留。If you don’t have any existing Azure Cosmos DB resources, the reservation will apply when you deploy a new Cosmos DB instance that matches the terms of the reservation. 这两种情况的预留期均于成功购买后立即开始。In both cases, the period of the reservation starts immediately after a successful purchase.

预留到期时,Azure Cosmos DB 实例会继续运行,按正常即用即付资费计费。When your reservation expires, your Azure Cosmos DB instances continue to run and are billed at the regular pay-as-you-go rates.

对预留执行取消、交换或退款操作Cancel, exchange, or refund reservations

可以在一定的限制下对预留执行取消、交换或退款操作。You can cancel, exchange, or refund reservations with certain limitations. 有关详细信息,请参阅 Azure 预留的自助交换和退款For more information, see Self-service exchanges and refunds for Azure Reservations.

后续步骤Next steps

预留折扣自动应用于与预留范围和属性相符的 Azure Cosmos DB 资源。The reservation discount is applied automatically to the Azure Cosmos DB resources that match the reservation scope and attributes. 可以通过 Azure 门户、PowerShell、Azure CLI 或 API 更新预留的范围。You can update the scope of the reservation through the Azure portal, PowerShell, Azure CLI, or the API.

需要帮助?Need help? 请联系我们。Contact us.

如有任何疑问或需要帮助,请创建支持请求If you have questions or need help, create a support request.