了解 Azure Cosmos DB 帐单Understand your Azure Cosmos DB bill

Azure Cosmos DB 是完全托管的云原生数据库服务,仅针对预配的吞吐量和消耗的存储收费,从而简化计费。As a fully managed cloud-native database service, Azure Cosmos DB simplifies billing by charging only for provisioned throughput and consumed storage. 与本地或 IaaS 托管的替代方案相比,无需额外的许可费、硬件、使用成本或设施成本。There are no additional license fees, hardware, utility costs, or facility costs compared to on-premises or IaaS-hosted alternatives. 若想使用 Azure Cosmos DB 的多区域功能,与现有本地或 IaaS 解决方案相比,数据库服务可显着降低成本。When you consider the multi region capabilities of Azure Cosmos DB, the database service provides a substantial reduction in costs compared to existing on-premises or IaaS solutions.

使用 Azure Cosmos DB 时,需根据预配的吞吐量和使用的存储按小时付费。With Azure Cosmos DB, you are billed hourly based on the provisioned throughput and the consumed storage. 对于预配的吞吐量,计费单位为每小时 100 RU/秒,每小时收取 0.082 元(假定为标准公开定价),请参阅定价页面For the provisioned throughput, the unit for billing is 100 RU/sec per hour, charged at CNY0.082 per hour, assuming standard public pricing, see the Pricing page. 对于消耗的存储,每月每 1 GB 存储收取 2.576 元,请参阅定价页面For the consumed storage, you are billed CNY2.576 per 1 GB of storage per month, see the Pricing page.

本文通过一些示例来帮助你了解每月帐单上的详细信息。This article uses some examples to help you understand the details you see on the monthly bill. 若存在以下情况,则示例中显示的数字可能会有所不同:Azure Cosmos 容器预配的吞吐量不同;容器跨多个区域;或在一个月内在不同时期运行。The numbers shown in the examples may be different if your Azure Cosmos containers have a different amount of throughput provisioned, if they span across multiple regions or run for a different for a period over a month.

备注

计费针对挂钟时间的任何部分,而不是 60 分钟的持续时间。Billing is for any portion of a wall-clock hour, not a 60 minute duration.

计费示例Billing examples

计费示例 – 容器上的吞吐量(整月)Billing example - throughput on a container (full month)

  • 假设在容器上配置了 1,000 RU/秒的吞吐量,且在该月总共存在 24 小时* 31 天 = 744 小时。Let's assume you configure a throughput of 1,000 RU/sec on a container, and it exists for 24 hours * 31 days for the month = 744 hours total.

  • 容器每小时存在的 1,000 RU/秒是 10 个每小时 100 RU/秒(即 1,000/100 = 10)。1,000 RU/sec is 10 units of 100 RU/sec per hour for each hour the containers exists (that is, 1,000/100 = 10).

  • 以每小时 10 个单位乘以成本 0.082 元(每小时每 100 RU/秒)= 每小时 0.82 元。Multiplying 10 units per hour by the cost of CNY0.082 (per 100 RU/sec per hour) = CNY0.82 per hour.

  • 以每小时 0.82 元乘以当月的小时数,即 0.82 * 24 小时 * 31 天 = 当月 610.1 元。Multiplying the CNY0.82 per hour by the number of hours in the month equals CNY0.82 * 24 hours * 31 days = CNY610.1 for the month.

  • 月度总帐单将显示 7,440 个单位(100 个 RU),费用为 610.1 元。The total monthly bill will show 7,440 units (of 100 RUs), which will cost CNY610.1.

计费示例 – 容器上的吞吐量(不足一个月)Billing example - throughput on a container (partial month)

  • 假设创建一个预配吞吐量为 2,500 RU/秒的容器。容器在一个月内存在 24 小时(例如,在创建容器后 24 小时将其删除)。Let's assume we create a container with provisioned throughput of 2,500 RU/sec. The container lives for 24 hours over the month (for example, we delete it 24 hours after we create it).

  • 则帐单上会显示 600 个单位(2,500 RU/秒/100 RU/秒/单位* 24小时)。Then we'll see 600 units on the bill (2,500 RU/sec / 100 RU/sec/unit * 24 hours). 费用为 49.2 元(600 个单位 * 0.082 元/单位)。The cost will be CNY49.2 (600 units * CNY0.082/unit).

  • 当月总帐单将为 49.2 元。Total bill for the month will be CNY49.2.

存储大小变化时的计费率Billing rate if storage size changes

存储容量按一个月内每小时的最大数据存储量(以 GB 为单位)计费。Storage capacity is billed in units of the maximum hourly amount of data stored, in GB, over a monthly period. 例如,如果前半个月使用了 100 GB 的存储空间,而后半个月使用了 50 GB 的存储空间,则该月将按 75 GB 的等效存储空间进行计费。For example, if you utilized 100 GB of storage for half of the month and 50 GB for the second half of the month, you would be billed for an equivalent of 75 GB of storage during that month.

容器或一组容器活动时间在一小时内的计费率Billing rate when container or a set of containers are active for less than an hour

将对容器或数据库存在的每小时按统一费率进行收费,而无论使用量是多少,也无论容器或数据库使用时间是否不足一个小时。You're billed the flat rate for each hour the container or database exists, no matter the usage or if the container or database is active for less than an hour. 例如,如果创建一个容器或数据库,然后在 5 分钟后删除它,那么帐单显示 1 个小时的费用。For example, if you create a container or database and delete it 5 minutes later, your bill will include one hour.

容器或数据库上的吞吐量扩展/缩减时的计费率Billing rate when throughput on a container or database scales up/down

如果在上午 9:30 将预配的吞吐量从 400 RU/秒增加到 1,000 RU/秒,然后在上午 10:45 将预配的吞吐量重新减少到 400 RU/秒,则将收取两小时 1,000 RU/秒的费用。If you increase provisioned throughput at 9:30 AM from 400 RU/sec to 1,000 RU/sec and then lower provisioned throughput at 10:45 AM back to 400 RU/sec, you will be charged for two hours of 1,000 RU/sec.

如果在上午 9:30 将某个容器或一组容器的预配吞吐量从 100K RU/秒增加到 200K RU/秒,然后在上午 10:45 将预配的吞吐量重新减少到 100K RU/秒,则将收取两小时 200K RU/秒的费用。If you increase provisioned throughput for a container or a set of containers at 9:30 AM from 100-K RU/sec to 200-K RU/sec and then lower provisioned throughput at 10:45 AM back to 100-K RU/sec, you'll be charged for two hours of 200 K RU/sec.

计费示例:多个容器,每个容器都采用专用的预配吞吐量模式Billing example: multiple containers, each with dedicated provisioned throughput mode

  • 如果在中国东部 2 区域创建包含两个容器的 Azure Cosmos 帐户,并且这两个容器分别预配了 500 RU/秒和 700 RU/秒的吞吐量,则预配的总吞吐量将为 1,200 RU/秒。If you create an Azure Cosmos account in China East 2 with two containers with provisioned throughput of 500 RU/sec and 700 RU/sec, respectively, you would have a total provisioned throughput of 1,200 RU/sec.

  • 需支付 1,200/100 * 0.082 元 = 0.984 元/小时。You would be charged 1,200/100 * CNY0.082 = CNY0.984/hour.

  • 如果需要更改吞吐量,且每个容器的容量增加了 500 RU/秒,同时还以 20,000 RU/秒创建了新的无限容器,则预配的总体容量为 22,200 RU/秒(1,000 RU/秒 + 1,200 RU/秒 + 20,000 RU/秒)。If your throughput needs changed, and you've increased each container's capacity by 500 RU/sec while also creating a new unlimited container with 20,000 RU/sec, your overall provisioned capacity would be 22,200 RU/sec (1,000 RU/sec + 1,200 RU/sec + 20,000RU/sec).

  • 此时需支付: 0.082 元 x 222 = 18.21 元/小时。Your bill would then change to: CNY0.082 x 222 = CNY18.21/hour.

  • 假设一个月为 744 小时(24 小时 * 31 天),如果 500 小时的预配吞吐量为 1,200 RU/秒,其余 244 小时的预配吞吐量为 22,200 RU/秒,则月度帐单将显示:500 x 0.984 元/小时 + 244 x 18.21元/小时 = 13402.56 元/月。In a month of 744 hours (24 hours * 31 days), if for 500 hours provisioned throughput was 1,200 RU/sec and for the remaining 244 hours provisioned throughput was 22,200 RU/sec, your monthly bill shows: 500 x CNY0.984/hour + 244 x CNY18.21/hour = CNY13402.56/month.

计费示例:具有共享吞吐量模式的容器Billing example: containers with shared throughput mode

  • 如果在中国东部 2 区域创建包含两个 Azure Cosmos 数据库(其中含有一组在数据库级别共享吞吐量的容器)的 Azure Cosmos 帐户,并且这两个容器分别预配了 50K RU/秒和 70K RU/秒的吞吐量,则预配的总吞吐量将为 120K RU/秒。If you create an Azure Cosmos account in China East 2 with two Azure Cosmos databases (with a set of containers sharing the throughput at the database level) with the provisioned throughput of 50-K RU/sec and 70-K RU/sec, respectively, you would have a total provisioned throughput of 120 K RU/sec.

  • 需支付 1200 x 0.082 元 = 98.4 元/小时。You would be charged 1200 x CNY0.082 = CNY98.4/hour.

  • 如果需要更改吞吐量,且每个数据库的预配吞吐量增加了 10K RU/秒,同时还向第一个数据库添加了新容器,共享吞吐量数据库的专用吞吐量模式为 15K RU /秒,则预配的总体容量为 155K RU/秒(60K RU/秒 + 80K RU/秒 + 15K RU/秒)。If your throughput needs changed and you increased each database's provisioned throughput by 10K RU/sec for each database, and you add a new container to the first database with dedicated throughput mode of 15-K RU/sec to your shared throughput database, your overall provisioned capacity would be 155-K RU/sec (60 K RU/sec + 80 K RU/sec + 15 K RU/sec).

  • 此时需支付:1,550 * 0.082 元 = 127.10 元/小时。Your bill would then change to: 1,550 * CNY0.082 = CNY127.10/hour.

  • 假设一个月为 744 小时,如果 300 小时的预配吞吐量为 120K RU/秒,其余 444 小时的预配吞吐量为 155K RU/秒,则月度帐单将显示:300 x 98.4 元/小时 + 444 x 127.10 元/小时 = 29,520 元 + 56,433 元 = 85,953 元/月。In a month of 744 hours, if for 300 hours provisioned throughput was 120-K RU/sec and for the remaining 444 hours provisioned throughput was 155-K RU/sec, your monthly bill will show: 300 x CNY98.4/hour + 444 x CNY127.10/hour = CNY29,520 + CNY56,433 = CNY85,953/month.

采用异地复制和多主数据库的计费示例Billing examples with geo-replication and multi-master

可随时向 Azure Cosmos 数据库帐户添加/删除中国 Azure 区域。You can add/remove Azure regions anywhere in China to your Azure Cosmos database account at any time. 对于为不同 Azure Cosmos 数据库和容器配置的吞吐量,可在与 Azure Cosmos 数据库帐户关联的每个 Azure 区域中保留这些吞吐量。The throughput that you have configured for various Azure Cosmos databases and containers will be reserved in each of the Azure regions associated with your Azure Cosmos database account. 如果在 Azure Cosmos 数据库帐户(按小时配置)中的所有数据库和容器中配置的总预配吞吐量(RU /秒)为 T,而与数据库帐户关联的 Azure 区域数为 N,则对于 Azure Cosmos 数据库帐户而言,在给定时间内(小时)总预配吞吐量分别为:(a) 配置了单个写入区域时,总吞吐量 = T x N RU/秒;(b) 配置了所有能够处理写入的区域时,总吞吐量 = T x (N + 1) RU/每秒。If the sum of provisioned throughput (RU/sec) configured across all the databases and containers within your Azure Cosmos database account (provisioned per hour) is T and the number of Azure regions associated with your database account is N, then the total provisioned throughput for a given hour, for your Azure Cosmos database account, (a) configured with a single write region is equal to T x N RU/sec and (b) configured with all regions capable of processing writes is equal to T x (N+1) RU/sec, respectively. 预配吞吐量(单个写入区域)每 100 RU/秒的费用为 0.082 元/小时,对于多个写入区域(配置多主数据库),每 100 RU/秒的费用为 0.102 元/小时(参阅定价页面)。Provisioned throughput (single write region) costs CNY0.082/hour per 100 RU/sec and provisioned throughput with multiple writable regions (multi-master config) costs CNY0.102/per hour per 100 RU/sec (see the Pricing page). 无论是单个写入区域还是多个写入区域,Azure Cosmos DB 都支持从任何区域读取数据。Whether its single write region, or multiple write regions, Azure Cosmos DB allows you to read data from any region.

计费示例:多区域 Azure Cosmos 帐户,单个区域写入Billing example: multi-region Azure Cosmos account, single region writes

假定存在位于中国北部的 Azure Cosmos 容器。Let's assume you have an Azure Cosmos container in China North. 创建容器时,指定的吞吐量为 10K RU/秒,本月可存储 1 TB 的数据。The container is created with throughput 10K RU/sec and you store 1 TB of data this month. 假定向 Azure Cosmos 帐户添加 3 个区域(中国东部、中国北部 2 和中国东部 2),每个区域都具有相同的存储和吞吐量。Let's assume you add three regions (China East, China North 2, and China East 2) to your Azure Cosmos account, each with the same storage and throughput. 则月度帐单为(假定一个月 31 天)。Your total monthly bill will be (assuming 31 days in a month). 帐单情况如下:Your bill would be as follows:

项目Item 使用情况(月)Usage (month) 费率Rate 每月成本Monthly Cost
中国北部容器的吞吐量帐单Throughput bill for container in China North 10K RU/秒 * 24 * 3110K RU/sec * 24 * 31 每 100 RU/秒每小时 0.082 元CNY0.082 per 100 RU/sec per hour 6,101 元CNY6,101
3 个其他区域 - 中国东部、中国北部 2 和中国东部 2 的吞吐量帐单Throughput bill for 3 additional regions - China East, China North 2, and China East 2 3 * 10K RU/秒 * 24 * 313 * 10K RU/sec * 24 * 31 每 100 RU/秒每小时 0.082 元CNY0.082 per 100 RU/sec per hour 18,303 元CNY18,303
中国北部容器的存储帐单Storage bill for container in China North 250 GB250 GB 2.576 元/GBCNY2.576/GB 644 元CNY644
3 个其他区域 - 中国东部、中国北部 2 和中国东部 2 的存储帐单Storage bill for 3 additional regions - China East, China North 2, and China East 2 3 * 250 GB3 * 250 GB 2.576 元/GBCNY2.576/GB 1,932 元CNY1,932
总计Total 26,980 元CNY26,980

此外,假定每月从中国北部的容器中传出 100 GB 数据,将数据复制到中国东部、中国北部 2 和中国东部 2。 则需要按数据传输速率为导出部分付费。Let's also assume that you egress 100 GB of data every month from the container in China North to replicate data into China East, China North 2, and China East 2. You're billed for egress as per data transfer rates.

计费示例:多区域 Azure Cosmos 帐户,多个区域写入Billing example: multi-region Azure Cosmos account, multi region writes

假定创建位于中国北部的 Azure Cosmos 容器。Let's assume you create an Azure Cosmos container in China North. 创建容器时,指定的吞吐量为 10K RU/秒,本月可存储 1 TB 的数据。The container is created with throughput 10K RU/sec and you store 1 TB of data this month. 假定添加 3 个区域(中国东部、中国北部 2 和中国东部 2),每个区域的存储和吞吐量都相同,并且你希望能够写入到与 Azure Cosmos 帐户关联的所有区域中的容器。Let's assume you add three regions (China East, China North 2, and China East 2), each with the same storage and throughput and you want the ability to write to the containers in all regions associated with your Azure Cosmos account. 则月度帐单(假定一个月 31 天)情况如下:Your total monthly bill will be (assuming 31 days in a month) as follows:

项目Item 使用情况(月)Usage (month) 费率Rate 每月成本Monthly Cost
中国北部容器的吞吐量帐单(所有区域都可写入)Throughput bill for container in China North (all regions are writable) 10K RU/秒 * 24 * 3110K RU/sec * 24 * 31 每 100 RU/秒每小时 0.102 元CNY0.102 per 100 RU/sec per hour 7589 元CNY7589
3 个其他区域 - 中国东部、中国北部 2 和中国东部 2(所有区域均可写入)的吞吐量帐单Throughput bill for 3 additional regions - China East, China North 2, and China East 2 (all regions are writable) (3 + 1) * 10K RU/秒 * 24 * 31(3 + 1) * 10K RU/sec * 24 * 31 每 100 RU/秒每小时 0.102 元CNY0.102 per 100 RU/sec per hour 30,355.2 元CNY30,355.2
中国北部容器的存储帐单Storage bill for container in China North 250 GB250 GB 2.576 元/GBCNY2.576/GB 644 元CNY644
3 个其他区域 - 中国东部、中国北部 2 和中国东部 2 的存储帐单Storage bill for 3 additional regions - China East, China North 2, and China East 2 3 * 250 GB3 * 250 GB 2.576 元/GBCNY2.576/GB 1,932 元CNY1,932
总计Total 40,520.2 元CNY40,520.2

此外,假定每月从中国北部的容器中传出 100 GB 数据,将数据复制到中国东部、中国北部 2 和中国东部 2。 则需要按数据传输速率为导出部分付费。Let's also assume that you egress 100 GB of data every month from the container in China North to replicate data into China East, China North 2, and China East 2. You're billed for egress as per data transfer rates.

主动估算每月帐单Proactively estimating your monthly bill

我们来看看另一个示例,介绍希望在月末之前主动估算帐单的情况。Let's consider another example, where you want to proactively estimate your bill before the month's end. 可按如下方式估算帐单:You can estimate your bill as follows:

存储成本Storage Cost
平均记录大小 (KB)Avg Record Size (KB) 11
记录数Number of Records 100,000,000100,000,000
总存储 (GB)Total Storage (GB) 100100
每 GB 的月度成本Monthly cost per GB 2.576 元CNY2.576
预期的月度存储成本Expected Monthly Cost for Storage 257.6 元CNY257.6

吞吐量成本Throughput Cost
操作类型Operation Type 请求数/秒Requests/sec 平均值RU/请求Avg. RU/request 所需 RURUs needed
写入Write 100100 55 500500
读取Read 400400 11 400400

总 RU/秒:500 + 400 = 900;每小时成本:900/100 * 0.082 元 = 0.738 元;预期的月度吞吐量成本(假定每月 31 天):0.738 元 * 24 * 31 = 549.1 元Total RU/sec: 500 + 400 = 900 Hourly cost: 900/100 * CNY0.082 = CNY0.738 Expected Monthly Cost for Throughput (assuming 31 days): CNY0.738 * 24 * 31 = CNY549.1

每月总成本Total Monthly Cost

月度总成本 = 月度存储成本 + 月度吞吐量成本;月度总成本 = 257.6 元 + 549.1 元 = 806.7 元Total Monthly Cost = Monthly Cost for Storage + Monthly Cost for Throughput Total Monthly Cost = CNY257.6 + CNY549.1 = CNY806.7

区域不同定价可能有所不同。 有关最新定价,请参阅定价页面Pricing may vary by region. For up-to-date pricing, see the Pricing page.

后续步骤Next Steps

接下来,可通过以下文章了解 Azure Cosmos DB 中的成本优化:Next you can proceed to learn about cost optimization in Azure Cosmos DB with the following articles: