作为键值存储的 Azure Cosmos DB - 费用概述Azure Cosmos DB as a key value store - cost overview

适用于: SQL API

Azure Cosmos DB 是一个多区域分布式多模型数据库服务,用于轻松构建高度可用的大规模应用程序。Azure Cosmos DB is a multiple-regionally distributed, multi-model database service for building highly available, large-scale applications easily. 默认情况下,Azure Cosmos DB 会自动并高效地为其引入的所有数据编制索引。By default, Azure Cosmos DB automatically and efficiently indexes all the data it ingests. 因此,可针对数据执行快速一致的 SQL(和 JavaScript)查询。This enables fast and consistent SQL (and JavaScript) queries on the data.

本文介绍使用 Azure Cosmos DB 作为键/值存储执行简单写入和读取操作时产生的成本。This article describes the cost of Azure Cosmos DB for simple write and read operations when it's used as a key/value store. 写入操作包括数据项的插入、替换、删除和更新插入。Write operations include inserts, replaces, deletes, and upserts of data items. 除了保证所有多区域帐户 99.999% 的可用性 SLA 外,Azure Cosmos DB 还保证在 99% 的情况下读取和(索引)写入延迟小于 10 毫秒。Besides guaranteeing a 99.999% availability SLA for all multi-region accounts, Azure Cosmos DB offers guaranteed <10-ms latency for reads and for the (indexed) writes, at the 99th percentile.

为何使用请求单位 (RU)Why we use Request Units (RUs)

Azure Cosmos DB 性能基于以请求单位(RU/秒)表示的预配吞吐量的数量。Azure Cosmos DB performance is based on the amount of provisioned throughput expressed in Request Units (RU/s). 预配按另一种粒度,根据每秒 RU 数(请不要与每小时计费相混淆)购买。The provisioning is at a second granularity and is purchased in RU/s (not to be confused with the hourly billing). 应将 RU 视为一种逻辑抽象(一种货币),用于简化应用程序所需吞吐量的预配过程。RUs should be considered as a logical abstraction (a currency) that simplifies the provisioning of required throughput for the application. 用户不必考虑区分读取和写入吞吐量。Users do not have to think of differentiating between read and write throughput. RU 的单一货币模型能够有效地在读取和写入之间分享预配的容量。The single currency model of RUs creates efficiencies to share the provisioned capacity between reads and writes. 这种预配的容量模型使服务能够提供 可预测且一致的吞吐量,保证低延迟和高可用性This provisioned capacity model enables the service to provide a predictable and consistent throughput, guaranteed low latency, and high availability. 最后,虽然 RU 模型用于描述吞吐量,但每个预配的 RU 也有一定的资源量(例如,内存、核心数/CPU 和 IOPS)。Finally, while RU model is used to depict throughput, each provisioned RU also has a defined amount of resources (e.g., memory, cores/CPU and IOPS).

作为一个多区域分布式数据库系统,Cosmos DB 是唯一个提供全面 SLA(涵盖延迟、吞吐量、一致性和高可用性)的 Azure 服务。As a multiple-regionally distributed database system, Cosmos DB is the only Azure service that provides comprehensive SLAs covering latency, throughput, consistency and high availability. 预配的吞吐量将应用到与 Cosmos 帐户关联的每个区域。The throughput you provision is applied to each of the regions associated with your Cosmos account. 对于读取,Cosmos DB 提供多个妥善定义的一致性级别供用户选择。For reads, Cosmos DB offers multiple, well-defined consistency levels for you to choose from.

下表显示了在默认自动索引关闭的情况下基于大小为 1 KB 和 100 KB 的数据项执行读取和写入操作所需的 RU 数。The following table shows the number of RUs required to perform read and write operations based on a data item of size 1 KB and 100 KBs with default automatic indexing turned off.

项大小Item Size 1 次读取1 Read 1 次写入1 Write
1 KB1 KB 1 RU1 RU 5 RU5 RUs
100 KB100 KB 10 RU10 RUs 50 RU50 RUs

读取和写入成本Cost of reads and writes

如果预配 1,000 RU/秒,则相当于 360 万 RU/小时,因此,每小时成本为 0.51 元(Azure 中国)。If you provision 1,000 RU/s, this amounts to 3.6 million RU/hour and will cost CNY0.51 for the hour (in Azure China). 对于 1 KB 大小的数据项,这意味着可以使用预配的吞吐量消费 360 万次读取或 72 万次写入(360 万 RU / 5)。For a 1 KB size data item, this means that you can consume 3.6 million reads or 0.72 million writes (3.6 million RU / 5) using your provisioned throughput. 规范化为百万次读取和写入后,成本将是 0.142 元/百万次读取(0.51 元/3.6)和 0.708 元/百万次写入(0.51 元/0.72)。Normalized to million reads and writes, the cost would be CNY0.142 /million of reads (CNY0.51 / 3.6) and CNY0.708/million of writes (CNY0.51 / 0.72). 如下表中所示,百万次读写费用极低。The cost per million becomes minimal as shown in the table below.

项大小Item Size 1 百万次读取的费用Cost of 1 million reads 1 百万次写入的费用Cost of 1 million writes
1 KB1 KB 0.142 元CNY0.142 0.708 元CNY0.708
100 KB100 KB 1.42 元CNY1.42 7.08 元CNY7.08

后续步骤Next steps