Understanding Azure Cosmos DB Billing Components and Request Units
Azure Cosmos DB billing model consists of two main components - Consumed Storage and Provisioned Throughput. You are billed based on the storage consumption and provisioned throughput. Request Units (RUs) abstract physical resources for performing requests, with specific RU costs for different types of operations. Estimating required RUs involves identifying query patterns and access frequencies. Autopilot mode allows for automatic scaling of throughput based on workload needs.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Billing Model Two components: Consumed Storage + Provisioned Throughput Unit Price (for most Azure regions) SSD Storage (per GB) $0.25 per month Provisioned Throughput (single region writes) $0.008/hour per 100 RU/s Provisioned Throughput (multi-region writes) $0.016/hour per 100 multi-region write RU/s You are billed on consumed storage and provisioned throughput Containers in a database can share throughput * pricing may vary by region; for up-to-date pricing, see: https://azure.microsoft.com/pricing/details/cosmos-db/
Request Units Request Units (RUs) is a rate-based currency e.g. 1000 RU/second % Memory % CPU % IOPS Abstracts physical resources for performing requests
Request Units = GET Each request consumes # of RU Approx. 1 RU = 1 read of 1 KB document = POST Approx. 5 RU = 1 write of a 1KB document = Query: Depends on query & documents involved PUT = Query
Request Units- Provisioned throughput Provisioned in terms of RU/sec e.g. 1000 RU/s Billed for highest RU/s in 1 hour Incoming Requests Rate limiting SDK retry Easy to increase and decrease on demand Max RU/sec No rate limiting Rate limiting based on amount of throughput provisioned Min RU/sec Background processes like TTL expiration, index transformations scheduled when quiescent No rate limiting, process background operations
Estimating Required RUs Operation Type Write Single Document Top Query #1 Top Query #2 Top Query #3 Total RU/s Total RU/s # Requests per sec # RU's per Request RU's Needed 10 100 100 100 10,000 700 200 100 100,000 70,000 20,000 10,000 200,000 RU/s Guidance: Identify query & access patterns e.g. top 5 queries, or # reads/writes per second Use Request Charge property from SDK + sample document to see # RU / operation POC / Load test -> Scale up, and scale down
Autopilot Mode for Throughput While it is easy to estimate and scale throughput in Azure Cosmos DB, some customers prefer if scaling is managed automatically When enabling autopilotmode on Cosmos containers, customers only need to specify a maximum throughput (Tmax) not be exceeded. Containers will scale instantly and automatically based on workload needs Containers will scale between 0.1*Tmax and Tmax
Autopilot Mode vs Manually Provisioned Throughput Azure Cosmos containers that are configured in autopilot mode have the following benefits: Simple There is no need to invest time in manually scaling throughput or writing code to automatically scale throughput Reliable Autopilot scaling is fully managed by Microsoft. There is no disruption to client connections, applications, or impact to SLA s. No rate-limiting of operations Rate limiting (throttled requests) will not happen if throughput consumed is within the max throughput chosen for autopilot mode. Autopilot mode pricing: Single-region write accounts- Cost for provisioned RU s is 50% higher Multi-region write accounts- Cost for provisioned RU s is identical to cost of manually provisioned throughput RU s
Database Level Throughput You can provision throughput at the database level instead of individually for each container Throughput is shared among each designated container within the database You can provision dedicated throughput for some containers
Database vs Container Level Throughput In general, container level throughput is a good choice. This leads to predictable performance since each container is guaranteed its provisioned RU s. Choosing Database Level Throughput can also be a good option if: You are migrating many containers in a lift and shift migration (from Table Storage, MongoDB, or Cassandra) and do not know how much throughput to set for each one You have containers that are timeshared Multitenant applications where each user is represented by a separate container
Pricing Example Do this exercise to ballpark cost + RU/s required Storage Cost Avg Record Size (KB) Number of Records Total Storage (GB) Monthly Cost per GB Expected Monthly Cost for Storage 1 100,000,000 100 $0.25 $25.00 Throughput Cost Operation Type Create Read Number of Requests per sec Avg RU's per Request RU's Needed 100 400 5 1 500 400 Total RU/sec Hourly Cost per 100 RU/sec Monthly Cost per 100 RU/sec Expected Monthly Cost for Throughput 900 $0.008 $6.00 $54.00 Total Monthly Cost [Total Monthly Cost] = [Monthly Cost for Storage] + [Monthly Cost for Throughput] = $25 + $54 = $79 per month * pricing may vary by region; for up-to-date pricing, see: https://azure.microsoft.com/pricing/details/cosmos-db/
Save up to 65% with Azure Cosmos DB reserved capacity pricing COSMOS DB RESERVED CAPACITY CAN PROVIDE UP TO 65% SAVINGS + Up to 65% savings Customer cost Best value for the price Saturation of provisioned capacity via sub-core multiplexing Best elasticity for the price Deep integration w/ Azure Networking No need to segment into read and write workloads w/ unified and normalized throughput currency - RUs Enterprise-ready (security, compliance, encryption) at no additional cost Total Time To Live (TTL) is free
Marginal Discounts Azure Cosmos DB Reserved Capacity 1 Year 3 Year Throughput Single Region Writes Multiple Regions Writes Single Region Writes Multiple Regions Writes First 100K RU/s 20% 25% 30% 35% Azure Cosmos DB Reserved Capacity helps you save money by pre-paying for one-year or three- years of Cosmos DB capacity allowing you to get a discount on the Cosmos DB resources, e.g., databases, containers (tables/collections/graphs) you use. Next 400K RU/s 25% 30% 35% 40% Next 2.5M RU/s 30% 35% 45% 50% Over 3M RU/s 45% 50% 60% 65% Azure Cosmos DB Reserved Capacity can significantly reduce your Cosmos DB costs up to 65 percent on regular prices with one-year or three-year upfront commitment. Effective Discounts Amount 1 Year single region writes 20.00% 3 Year - single region writes 30.00% 1 Year - multiple region writes 25.00% 3 Year - multiple region writes 35.00% 100,000 Reserved Capacity provides a billing discount and does not affect the runtime state of your Cosmos DB resources. 500,000 24.00% 34.00% 29.00% 39.00% 1,000,000 27.00% 39.50% 32.00% 44.50% 2,000,000 28.50% 42.25% 33.50% 47.25% 3,000,000 29.00% 43.17% 34.00% 48.17% 5,000,000 35.40% 49.90% 40.40% 54.90% 10,000,000 40.20% 54.95% 45.20% 59.95% 20,000,000 42.60% 57.48% 47.60% 62.48% 30,000,000 43.40% 58.32% 48.40% 63.32%