{"id":8580,"date":"2024-09-25T07:00:40","date_gmt":"2024-09-25T14:00:40","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=8580"},"modified":"2024-10-23T11:31:28","modified_gmt":"2024-10-23T18:31:28","slug":"announcing-the-ga-of-dynamic-scaling-per-region-and-per-partition-autoscale","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/announcing-the-ga-of-dynamic-scaling-per-region-and-per-partition-autoscale\/","title":{"rendered":"Announcing the GA of Dynamic Scaling (Per Region and Per Partition Autoscale)"},"content":{"rendered":"<p>We are excited to announce the GA of Azure Cosmos DB dynamic scaling \u2013 among multiple new features (<a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/announcing-cost-and-performance-improvements-with-azure-cosmos-dbs-binary-encoding\/\" target=\"_blank\" rel=\"noopener\">Binary Encoding<\/a>, <a href=\"https:\/\/aka.ms\/reservedcapacitydiscount\">Reserved Capacity<\/a>) released recently to make your Azure Cosmos DB workloads even more cost efficient.<strong> Dynamic scaling <\/strong>is an enhancement to autoscale which provides cost optimization for nonuniform workloads. In the earlier version of autoscale, all partitions scaled uniformly based on the most active partition, which caused unnecessary scale-ups if only one or a few partitions were active.\u00a0 With this new feature, partitions and regions now scale independently, improving cost efficiency for non-uniform large-scale workloads with multiple partitions and\/or multiple regions. We\u2019ve seen that dynamic scaling has helped customers save between 15% to 70% on autoscale costs, depending on workload patterns.<\/p>\n<h2>Ideal use cases for dynamic scaling<\/h2>\n<p>We recommend this feature to all customers interested in scaling the throughput (RU\/s) of their workloads automatically and instantly based on usage. However, there are two specific use cases where we see the most benefits:<\/p>\n<ul>\n<li>Database workloads that have a highly trafficked primary region and a secondary passive region for disaster recovery.\n<ul>\n<li>With dynamic scaling, you can now save costs as the secondary region will independently and automatically scale down while idle. Then automatically scale-up as it becomes active and while handling write replication from the primary region.<\/li>\n<\/ul>\n<\/li>\n<li>Multi-region database workloads.\n<ul>\n<li>These workloads often observe uneven distribution of requests across regions due to natural traffic growth and dips throughout the day. (e.g. a database might be active during business hours across globally distributed time zones).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 style=\"text-align: center;\"><iframe src=\"\/\/www.youtube.com\/embed\/9VtWbtsx0fo\" width=\"560\" height=\"314\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/h2>\n<h2>Real World Scenario<\/h2>\n<p>To understand the benefits of this feature, let&#8217;s look at a simplified real-world scenario and see the outcome with just autoscale versus dynamic autoscale:<\/p>\n<p>Contoso operates a multi-tenant application with primary write region in Central US and secondary read region in East US. Contoso currently manages 1000 tenants, utilizing <strong>TenantId <\/strong>as the partition key. The primary region handles both writes and reads, while the secondary region is configured for high availability and remains largely inactive. This customer\u2019s autoscale workload includes a collection with 50,000 RU\/s and five physical partitions\u2014each capable of scaling up to 10,000 RU\/s. These 1000 tenants are distributed across five physical partitions. Although most tenants exhibit uniform workloads, occasional spikes from one or two tenants cause the complete collection in both regions to reach maximum RU\/s. Furthermore, despite the lack of activity, the secondary region incurs the same charges as the primary. The distribution of RU\/s and utilization across the five partitions and two regions is depicted below.<\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Primary Region \u2013 Central US<\/strong><\/p>\n<table width=\"576\">\n<tbody>\n<tr>\n<td width=\"63\"><strong>Region<\/strong><\/td>\n<td width=\"78\"><strong>Partition<\/strong><\/td>\n<td width=\"82\"><strong>Throughput<\/strong><\/td>\n<td width=\"76\"><strong>Utilization<\/strong><\/td>\n<td width=\"278\"><strong>Consumed RU\/s &amp; Operations<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"63\">Write<\/td>\n<td width=\"78\">Partition 1<\/td>\n<td width=\"82\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"76\">35%<\/td>\n<td width=\"278\">3500 RU\/s \u2013 All Reads<\/td>\n<\/tr>\n<tr>\n<td width=\"63\">Write<\/td>\n<td width=\"78\">Partition 2<\/td>\n<td width=\"82\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"76\">35%<\/td>\n<td width=\"278\">3500 RU\/s \u2013 All Reads<\/td>\n<\/tr>\n<tr>\n<td width=\"63\">Write<\/td>\n<td width=\"78\">Partition 3<\/td>\n<td width=\"82\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"76\">100%<\/td>\n<td width=\"278\">10000 RU\/s (1800 RU\/s \u2013 Writes, 8200 RU\/s \u2013 Reads)<\/td>\n<\/tr>\n<tr>\n<td width=\"63\">Write<\/td>\n<td width=\"78\">Partition 4<\/td>\n<td width=\"82\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"76\">18%<\/td>\n<td width=\"278\">1800 RU\/s (1500 RU\/s \u2013 Writes, 300 RU\/s \u2013 Reads)<\/td>\n<\/tr>\n<tr>\n<td width=\"63\">Write<\/td>\n<td width=\"78\">Partition 5<\/td>\n<td width=\"82\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"76\">70%<\/td>\n<td width=\"278\">7000 RU\/s \u2013 All Reads<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u00a0<\/strong><\/p>\n<p><strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Secondary Region \u2013 East US<\/strong><\/p>\n<table width=\"586\">\n<tbody>\n<tr>\n<td width=\"57\"><strong>Region<\/strong><\/td>\n<td width=\"69\"><strong>Partition<\/strong><\/td>\n<td width=\"101\"><strong>Throughput<\/strong><\/td>\n<td width=\"80\"><strong>Utilization<\/strong><\/td>\n<td width=\"278\"><strong>Consumed RU\/s &amp; Operations<\/strong><\/td>\n<\/tr>\n<tr>\n<td width=\"57\">Read<\/td>\n<td width=\"69\">Partition 1<\/td>\n<td width=\"101\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"80\">10%<\/td>\n<td width=\"278\">1000 RU\/s<\/td>\n<\/tr>\n<tr>\n<td width=\"57\">Read<\/td>\n<td width=\"69\">Partition 2<\/td>\n<td width=\"101\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"80\">10%<\/td>\n<td width=\"278\">1000 RU\/s<\/td>\n<\/tr>\n<tr>\n<td width=\"57\">Read<\/td>\n<td width=\"69\">Partition 3<\/td>\n<td width=\"101\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"80\">18%<\/td>\n<td width=\"278\">1800 RU\/s \u2013 Replication RU\/s<\/td>\n<\/tr>\n<tr>\n<td width=\"57\">Read<\/td>\n<td width=\"69\">Partition 4<\/td>\n<td width=\"101\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"80\">15%<\/td>\n<td width=\"278\">1500 RU\/s \u2013 Replication RU\/s<\/td>\n<\/tr>\n<tr>\n<td width=\"57\">Read<\/td>\n<td width=\"69\">Partition 5<\/td>\n<td width=\"101\">1000 &#8211; 10000 RU\/s<\/td>\n<td width=\"80\">10%<\/td>\n<td width=\"278\">1000 RU\/s<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Let\u2019s look at the hourly utilization of Contoso in autoscale mode:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestbefore.png\"><img decoding=\"async\" class=\"alignnone wp-image-8713 \" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestbefore.png\" alt=\"Image latestbefore\" width=\"1816\" height=\"955\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestbefore.png 1816w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestbefore-300x158.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestbefore-1024x539.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestbefore-768x404.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestbefore-1536x808.png 1536w\" sizes=\"(max-width: 1816px) 100vw, 1816px\" \/><\/a><\/p>\n<p>At one point during the hour, the Central US region reached 100% utilization for a specific tenant. As a result, the autoscale feature scaled the provisioned throughput to 10,000 RU\/s across all five partitions in both regions, as that was the most active partition during that hour. Subsequently, we calculate the hourly RU\/s consumption as follows:<\/p>\n<p>Most active partition hourly RU\/s (request units) * Number of partitions * Number of Regions<\/p>\n<p>(i.e.) 10000*5*2 =<strong>100,000 RU\/s<\/strong><\/p>\n<p>Now, let\u2019s see how dynamic scaling improves the cost efficiency of Contoso\u2019s workload. The hourly utilization that we see in dynamic autoscale mode is as below:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestafter.png\"><img decoding=\"async\" class=\"alignnone wp-image-8714 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestafter.png\" alt=\"Image latestafter\" width=\"1780\" height=\"901\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestafter.png 1780w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestafter-300x152.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestafter-1024x518.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestafter-768x389.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/latestafter-1536x777.png 1536w\" sizes=\"(max-width: 1780px) 100vw, 1780px\" \/><\/a><\/p>\n<p>In dynamic autoscale, we sum up the maximum RU\/s utilized per hour for each region and partition, as each partition and region scale independently. Therefore, we calculate the hourly RU\/s consumption as follows:<\/p>\n<p>Sum up max RU\/s utilized per hour per region per partition (i.e.) ((3500+3500+10000+1800+7000) + (1000+1000+1800+1500+1000)) = <strong>32,100 RU\/s<\/strong><\/p>\n<p>This example demonstrates how dynamic autoscale\u00a0 helped Contoso save <strong>68%<\/strong> in RU consumption for the same workload.<\/p>\n<p><strong>Benefits observed by Azure Cosmos DB customers after enabling dynamic scaling:<\/strong><\/p>\n<ul>\n<li>Each region and partition scales independently, leading to significant cost optimization for non-uniform autoscale workloads.<\/li>\n<li>Adding secondary regions has become more cost-efficient because each region now scales independently based on actual usage. This allows you to achieve 99.999% high availability for reads and writes with multi-region writes at a lower<\/li>\n<li>The impact of hot partitions due to suboptimal partition keys is minimized, as only the hot partition is scaled to the maximum, unlike traditional autoscale where all partitions scale based on the hottest partition in the collection.<\/li>\n<li>In the public preview, customers have seen cost optimizations ranging from 15% to 70% on their actual autoscale costs, depending on their workload patterns.<\/li>\n<\/ul>\n<h2>What are customers saying about dynamic scaling?<\/h2>\n<p>In November 2023, we\u00a0announced the\u00a0public preview of <a href=\"https:\/\/aka.ms\/dynamicscalingpublicpreviewdevblog\" target=\"_blank\" rel=\"noopener\">dynamic scaling (per region and per partition autoscale). <\/a>\u00a0We want to give a major thank you to our customers who enabled this feature during the public preview. Check out what some of them had to say:<\/p>\n<p>\u201cSince enabling dynamic scaling within Azure Cosmos DB in May of this year, we have realized an impressive 65% reduction in our monthly Azure Cosmos DB spend. The Microsoft Product Team\u2019s engagement and support throughout our journey has been excellent and has helped us improve a critical application\u2019s performance and associated cost.\u201d &#8211; <strong>Joe MacKinnon, Director IT &#8211; Business Enablement of SECURE Energy Services<\/strong><\/p>\n<p>&#8220;The introduction of Azure Cosmos DB&#8217;s dynamic scaling feature couldn\u2019t have come at a better time. We were already working to optimize our cloud infrastructure for scalability and cost. Dynamic scaling just made it so much easier. The flexibility it offers for managing our bursty workloads is unparalleled. This not only streamlined our operations but also led to substantial cost savings, reinforcing our commitment to Azure Cosmos DB and the Azure Platform.&#8221;\u00a0 &#8211; <strong>Apurv Gupta, founder of Mailmodo<\/strong><\/p>\n<p>&#8220;With dynamic scaling for Azure Cosmos DB, we have been able to achieve 15% cost savings on average with zero intervention. dynamic scaling provides some much-needed relief by limiting the effects of hot partitions, which coupled with autoscale, enables us to safely scale our workloads based on our demands without having to worry about cost.&#8221; <strong>&#8211; Vineeth Raj, Director Engineering of Udaan<\/strong><\/p>\n<p>\u201cMoving our Azure Cosmos DB autoscale workloads to \u2018autoscale per partition\/region\u2019 has transformed our use of Cosmos. We were skeptical at first about the benefits, but the improvements of having our regions and partitions scale independently had a significant impact on our consumption cost for Cosmos. We achieved a remarkable 60% decrease in consumption cost for all our Azure Cosmos DB workloads which has now opened up use cases for other projects which were previously cost prohibitive.\u201d <strong>\u2013 <\/strong><strong>Clemence Thia<\/strong><strong>, Senior Cloud Engineer Global IT \u2013 Infrastructure &amp; DevOps of BDO Netherlands<\/strong><\/p>\n<h2><strong>Getting started<\/strong><\/h2>\n<p>Start by creating a new Azure Cosmos DB autoscale account. Use this guide to learn\u00a0<a href=\"https:\/\/aka.ms\/cosmos-autoscale-how-to\" target=\"_blank\" rel=\"noopener\">how to enable autoscale<\/a>\u00a0on a new or existing workload.<\/p>\n<ul>\n<li>Azure Cosmos DB enables dynamic scaling by default for accounts created after 25-Sep-2024. For older accounts created before this date, head over to the Features pane in Azure Portal. Here, you will be able to enable the feature. Please note that this enables the feature on all autoscale collections and autoscale shared databases within the account. Enabling this feature has zero downtime or performance impact.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/enable-feature.png\"><img decoding=\"async\" class=\"alignnone wp-image-8583 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/enable-feature.png\" alt=\"Image enable feature\" width=\"2032\" height=\"599\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/enable-feature.png 2032w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/enable-feature-300x88.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/enable-feature-1024x302.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/enable-feature-768x226.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/enable-feature-1536x453.png 1536w\" sizes=\"(max-width: 2032px) 100vw, 2032px\" \/><\/a><\/p>\n<p>For more information, please visit our documentation on<\/p>\n<p><a href=\"https:\/\/aka.ms\/dynamicscaling\" target=\"_blank\" rel=\"noopener\">Dynamic scaling (per region and per partition autoscale)<\/a><\/p>\n<p><a href=\"https:\/\/aka.ms\/autoscalefaq\" target=\"_blank\" rel=\"noopener\">Frequently asked questions about autoscale provisioned throughput in Azure Cosmos DB<\/a><\/p>\n<h2>Watch a demonstration!<\/h2>\n<p>Watch Azure Cosmos DB TV episode, &#8220;<a href=\"https:\/\/youtu.be\/i_7sc89oRdw\" target=\"_blank\" rel=\"noopener\">Cost Optimizations Provided by Azure Cosmos DB Dynamic Scaling<\/a>&#8221; for a demonstration.<\/p>\n<p><iframe src=\"\/\/www.youtube.com\/embed\/i_7sc89oRdw\" width=\"560\" height=\"314\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h2><strong>Leave a review<\/strong><\/h2>\n<p>Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we\u2019ll gift you $50. <a href=\"https:\/\/peerspotdotcom.my.site.com\/proReviews\/?SalesOpportunityProduct=00kPy000004TKXJIA4&amp;productPeerspotNumber=30881&amp;CalendlyAccount=peerspot&amp;CalendlyFormLink=peerspot-product-reviews-ps-gc-vi-sf-50&amp;giftCard=50\" target=\"_blank\" rel=\"noopener\">Get started here<\/a>.<\/p>\n<h2><strong>About Azure Cosmos DB<\/strong><\/h2>\n<p>Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.<\/p>\n<p><a href=\"https:\/\/cosmos.azure.com\/try\/\" target=\"_blank\" rel=\"noopener\">Try Azure Cosmos DB for free here.<\/a> To stay in the loop on Azure Cosmos DB updates, follow us on <a href=\"https:\/\/twitter.com\/AzureCosmosDB\" target=\"_blank\" rel=\"noopener\">X<\/a>, <a href=\"https:\/\/aka.ms\/AzureCosmosDBYouTube\" target=\"_blank\" rel=\"noopener\">YouTube<\/a>, and <a href=\"https:\/\/www.linkedin.com\/company\/azure-cosmos-db\/\" target=\"_blank\" rel=\"noopener\">LinkedIn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are excited to announce the GA of Azure Cosmos DB dynamic scaling \u2013 among multiple new features (Binary Encoding, Reserved Capacity) released recently to make your Azure Cosmos DB workloads even more cost efficient. Dynamic scaling is an enhancement to autoscale which provides cost optimization for nonuniform workloads. In the earlier version of autoscale, [&hellip;]<\/p>\n","protected":false},"author":168914,"featured_media":8699,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14],"tags":[1176,1872],"class_list":["post-8580","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-sql-api","tag-autoscale","tag-nosql"],"acf":[],"blog_post_summary":"<p>We are excited to announce the GA of Azure Cosmos DB dynamic scaling \u2013 among multiple new features (Binary Encoding, Reserved Capacity) released recently to make your Azure Cosmos DB workloads even more cost efficient. Dynamic scaling is an enhancement to autoscale which provides cost optimization for nonuniform workloads. In the earlier version of autoscale, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/8580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/168914"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=8580"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/8580\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/8699"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=8580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=8580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=8580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}