{"id":11310,"date":"2025-11-20T08:00:34","date_gmt":"2025-11-20T16:00:34","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=11310"},"modified":"2025-11-17T21:35:05","modified_gmt":"2025-11-18T05:35:05","slug":"general-availability-priority-based-execution-in-azure-cosmos-db","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/general-availability-priority-based-execution-in-azure-cosmos-db\/","title":{"rendered":"General Availability: Priority-Based Execution in Azure Cosmos DB"},"content":{"rendered":"<p>Have you ever faced a situation where two different workloads share the same container, and one ends up slowing down the other? This is a common challenge for many of our customers running applications on Azure Cosmos DB.<\/p>\n<p>Imagine these scenarios:<\/p>\n<ul>\n<li>A background job consumes most of the throughput, leaving end users frustrated with high latency.<\/li>\n<li>Free-tier users hog resources, while your premium customers struggle to access paid services and eventually churn.<\/li>\n<\/ul>\n<p>In all these cases, there\u2019s one workload you\u2019d prefer to prioritize, ensuring critical operations run smoothly while others can progress slowly during resource contention.<\/p>\n<h2>Introducing Priority-Based Execution<\/h2>\n<p>Priority-Based Execution solves this problem. It lets you assign high priority to critical workloads and low priority to less important ones using the Azure Cosmos DB SDKs.<\/p>\n<p>When your container hits 100% of its configured throughput, the system starts throttling low-priority requests first, preserving throughput for high-priority operations. This means you can maintain better performance for your key workloads without increasing RU\/s, keeping costs under control.<\/p>\n<h3>See It in Action<\/h3>\n<p><iframe src=\"\/\/www.youtube.com\/embed\/ONdQI-PQZYk\" width=\"560\" height=\"314\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h2>How to enable Priority based execution.<\/h2>\n<p>Navigate to the <strong>Features<\/strong> tab in your Azure Cosmos DB account and turn on the <strong>Priority-Based Execution<\/strong> feature.<\/p>\n<h2><img decoding=\"async\" width=\"1170\" height=\"547\" class=\"wp-image-11311\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-3.png\" alt=\"A screenshot of a computer AI-generated content may be incorrect.\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-3.png 1170w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-3-300x140.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-3-1024x479.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2025\/11\/a-screenshot-of-a-computer-ai-generated-content-m-3-768x359.png 768w\" sizes=\"(max-width: 1170px) 100vw, 1170px\" \/><\/h2>\n<h2>How to apply priority to requests?<\/h2>\n<p>Use PriorityLevel.Low or PriorityLevel.High in your request options:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">using Microsoft.Azure.Cosmos;\r\n\r\n\/\/update products catalog with low priority\r\nRequestOptions catalogRequestOptions = new ItemRequestOptions{PriorityLevel = PriorityLevel.Low};\r\nPartitionKey pk = new PartitionKey(\u201cproductId1\u201d);\r\nItemResponse&lt;Product&gt; catalogResponse = await this.container.CreateItemAsync&lt;Product&gt;(product1, pk, requestOptions);\r\n\r\n\/\/Display product information to user with high priority\r\nRequestOptions getProductRequestOptions = new ItemRequestOptions{PriorityLevel = PriorityLevel.High};\r\nstring id = \u201cproductId2\u201d;\r\nPartitionKey pk = new PartitionKey(id);\r\nItemResponse&lt;Product&gt; productResponse = await this.container.ReadItemAsync&lt; Product&gt;(id, pk, getProductRequestOptions);<\/code><\/pre>\n<p><span style=\"font-family: georgia, palatino, serif;\">The default priority level is High. If you don\u2019t specify a priority in the request options, it will automatically be set to High.<\/span>\n<span style=\"font-family: georgia, palatino, serif;\">You can change the default priority level for your Cosmos DB account by following the steps in this guide: <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/priority-based-execution?tabs=net-v3#change-default-priority-level-of-a-cosmos-db-account\">Change default priority level<\/a>.<\/span><\/p>\n<h2>Important considerations<\/h2>\n<ul>\n<li>Priority based execution is best effort, it doesn\u2019t guarantee that low priority requests will always be throttled in favour of high priority.<\/li>\n<li>If high-priority requests are consistently throttled, it means your configured RU\/s is insufficient for your primary workload. Consider increasing RU\/s for better performance.<\/li>\n<\/ul>\n<h2>Limitations<\/h2>\n<ul>\n<li>Not supported on <strong>serverless<\/strong> Cosmos DB accounts.<\/li>\n<li>Read requests cannot be prioritized against writes for <strong>Strong<\/strong> and <strong>Bounded Staleness<\/strong> consistency levels.<\/li>\n<\/ul>\n<h3>Resources<\/h3>\n<ul>\n<li>Learn more about <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/priority-based-execution\">Priority based execution<\/a>.<\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/priority-based-execution-faq\">Frequently Asked Questions<\/a> on Priority based execution.<\/li>\n<\/ul>\n<h2 id=\"leave-a-review\">Leave a review<\/h2>\n<p>Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we\u2019ll gift you $50.\u00a0<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 id=\"about-azure-cosmos-db\">About Azure Cosmos DB<\/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>To stay in the loop on Azure Cosmos DB updates, follow us on\u00a0<a href=\"https:\/\/twitter.com\/AzureCosmosDB\" target=\"_blank\" rel=\"noopener\">X<\/a>,\u00a0<a href=\"https:\/\/aka.ms\/AzureCosmosDBYouTube\" target=\"_blank\" rel=\"noopener\">YouTube<\/a>, and\u00a0<a href=\"https:\/\/www.linkedin.com\/company\/azure-cosmos-db\/\" target=\"_blank\" rel=\"noopener\">LinkedIn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever faced a situation where two different workloads share the same container, and one ends up slowing down the other? This is a common challenge for many of our customers running applications on Azure Cosmos DB. Imagine these scenarios: A background job consumes most of the throughput, leaving end users frustrated with high [&hellip;]<\/p>\n","protected":false},"author":90111,"featured_media":11312,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14],"tags":[],"class_list":["post-11310","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-sql-api"],"acf":[],"blog_post_summary":"<p>Have you ever faced a situation where two different workloads share the same container, and one ends up slowing down the other? This is a common challenge for many of our customers running applications on Azure Cosmos DB. Imagine these scenarios: A background job consumes most of the throughput, leaving end users frustrated with high [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11310","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\/90111"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=11310"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/11310\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/11312"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=11310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=11310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=11310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}