{"id":1547,"date":"2020-08-19T09:00:57","date_gmt":"2020-08-19T16:00:57","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=1547"},"modified":"2020-12-23T14:44:31","modified_gmt":"2020-12-23T22:44:31","slug":"serverless-preview","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/serverless-preview\/","title":{"rendered":"Azure Cosmos DB serverless now in preview"},"content":{"rendered":"<p><em>This blog post was co-authored by Nikisha Reyes-Grange, Senior Product Marketing Manager, Azure Marketing.<\/em><\/p>\n<p><em><strong>UPDATE<\/strong><\/em>: <strong>Serverless preview support for Azure Cosmos DB APIs for MongoDB, Cassandra, Gremlin, and Table began November 11, 2020.\u00a0<\/strong><\/p>\n<p>We are beyond excited to announce that <a href=\"https:\/\/aka.ms\/cosmos-serverless\">Azure Cosmos DB serverless<\/a> is now available in preview on the Core (SQL) API, with support for the APIs for MongoDB, Gremlin (graph), Table, and Cassandra coming soon. This new consumption-based model lets you use your containers cost-effectively, without having to provision any throughput.<\/p>\n<h3>What is serverless on Azure Cosmos DB?<\/h3>\n<p>Announced at the Build conference this past May, serverless radically changes the way you use and pay for your Azure Cosmos DB resources.<\/p>\n<p>Until now, your only option for running a workload on Azure Cosmos DB has been to provision throughput. This throughput, expressed in Request Units per second (RU\/s), is dedicated to your usage and available for your database operations to consume. This model comes with low-latency and high-availability SLAs, making it a great fit for high-traffic applications needing guaranteed performance &#8211; but not as well-suited to light traffic scenarios.<\/p>\n<p>Serverless is a cost-effective option for databases with sporadic traffic patterns and modest bursts. When your resources sit idle most of the time, it doesn\u2019t make sense to provision and pay for unneeded per-second capacity. As a consumption-based option, serverless eliminates the concept of provisioned throughput and instead <strong>charges you for the RUs your database operations consume<\/strong>.<\/p>\n<p>Check this video for a visual comparison between provisioned throughput and serverless:<\/p>\n<p style=\"text-align: center;\"><iframe src=\"\/\/www.youtube.com\/embed\/CgYQo6uHyt0\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h3>Differences with provisioned throughput<\/h3>\n<p>Serverless containers expose the <strong>same capabilities<\/strong> as containers created in provisioned throughput mode. This means that you manage your resources and read, write and query your data the exact same way. Where serverless accounts and containers differ from those using provisioned throughput is:<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 112px;\">\n<tbody>\n<tr style=\"height: 28px;\">\n<td style=\"width: 47.1288%; height: 28px;\"><\/td>\n<td style=\"width: 27.2576%; height: 28px;\"><strong>Provisioned throughput<\/strong><\/td>\n<td style=\"width: 25.6135%; height: 28px;\"><strong>Serverless<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 28px;\">\n<td style=\"width: 47.1288%; height: 28px;\">Maximum number of Azure regions per account<\/td>\n<td style=\"width: 27.2576%; height: 28px;\">unlimited<\/td>\n<td style=\"width: 25.6135%; height: 28px;\">1<\/td>\n<\/tr>\n<tr style=\"height: 28px;\">\n<td style=\"width: 47.1288%; height: 28px;\">Maximum storage per container<\/td>\n<td style=\"width: 27.2576%; height: 28px;\">unlimited<\/td>\n<td style=\"width: 25.6135%; height: 28px;\">50 GB<\/td>\n<\/tr>\n<tr style=\"height: 28px;\">\n<td style=\"width: 47.1288%; height: 28px;\">Throughput burstability<\/td>\n<td style=\"width: 27.2576%; height: 28px;\">unlimited<\/td>\n<td style=\"width: 25.6135%; height: 28px;\">moderate<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span style=\"text-decoration: underline;\"><strong>Note<\/strong>:<\/span> Some of these limitations may be eased or removed as serverless becomes generally available, and <strong>your feedback<\/strong> will help us decide! Please <a href=\"mailto:azurecosmosdbserverless@service.microsoft.com\">reach out<\/a> and tell us more about your serverless experience.<\/p>\n<p>When generally available, serverless will also offer different performance characteristics as explained in <a href=\"https:\/\/docs.microsoft.com\/azure\/cosmos-db\/serverless#performance\">this article<\/a>.<\/p>\n<h3>Use-cases<\/h3>\n<p>Because serverless is much more cost-effective in situations where you deal with light traffic and don\u2019t need provisioned capacity, it naturally fits the following use-cases:<\/p>\n<ul>\n<li>Getting started with Azure Cosmos DB<\/li>\n<li>Development, testing and prototyping of new applications<\/li>\n<li>Running small-to-medium applications with intermittent traffic that is hard to forecast<\/li>\n<li>Integrating with serverless compute services like <a href=\"https:\/\/docs.microsoft.com\/azure\/azure-functions\/functions-overview\">Azure Functions<\/a><\/li>\n<\/ul>\n<p>To illustrate the advantages of using serverless for these scenarios, let\u2019s take the example of a workload that is expected to burst to a maximum of 500 RU\/s and consume a total of 20,000,000 RUs over a month.<\/p>\n<ul>\n<li>In provisioned throughput mode, you would have to provision a container with 500 RU\/s for a monthly cost of: $0.008 * 5 * 730 = <strong>$29.20<\/strong><\/li>\n<li>In serverless mode, you would only pay for the consumed RUs: $0.25 * 20 = <strong>$5.00<\/strong><\/li>\n<\/ul>\n<p>(not accounting for the storage cost, which is the same between the 2 modes)<\/p>\n<h3>Getting started<\/h3>\n<p>You must create a new Azure Cosmos DB account from the Azure portal to get started with serverless. When creating your new account, select <strong>Core (SQL)<\/strong> as the <strong>API type<\/strong>, then <strong>Serverless (preview)<\/strong> under <strong>Capacity mode<\/strong>:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-1554 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/08\/svl-blog-create-account.png\" alt=\"Creating an account in serverless mode\" width=\"756\" height=\"217\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/08\/svl-blog-create-account.png 756w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/08\/svl-blog-create-account-300x86.png 300w\" sizes=\"(max-width: 756px) 100vw, 756px\" \/><\/p>\n<p>Once your new serverless account is created, you manage your Azure Cosmos DB resources and data just like you would in provisioned throughput mode. The only difference is that you don\u2019t have to specify any throughput when creating a container:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-1555 size-full\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/08\/svl-blog-create-container.png\" alt=\"Creating a serverless container\" width=\"336\" height=\"321\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/08\/svl-blog-create-container.png 336w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2020\/08\/svl-blog-create-container-300x287.png 300w\" sizes=\"(max-width: 336px) 100vw, 336px\" \/><\/p>\n<p>We can\u2019t wait to see what you will build on Azure Cosmos DB serverless! Get started today with the following resources:<\/p>\n<ul>\n<li><a href=\"https:\/\/aka.ms\/cosmos-serverless\">Serverless documentation<\/a><\/li>\n<li><a href=\"https:\/\/azure.microsoft.com\/pricing\/details\/cosmos-db\/\">Azure Cosmos DB pricing page<\/a><\/li>\n<li><a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/cosmos-db\/throughput-serverless\">How to choose between provisioned throughput and serverless<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Azure Cosmos DB serverless is a new\u202fconsumption-based\u202foffer that requires no capacity management. It bills only for the Request Units used by database operations and provides a lower entry price for development, testing and small applications with light traffic.<\/p>\n","protected":false},"author":13778,"featured_media":1576,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12],"tags":[499,1177],"class_list":["post-1547","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcements","tag-azure-cosmos-db","tag-serverless"],"acf":[],"blog_post_summary":"<p>Azure Cosmos DB serverless is a new\u202fconsumption-based\u202foffer that requires no capacity management. It bills only for the Request Units used by database operations and provides a lower entry price for development, testing and small applications with light traffic.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/1547","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\/13778"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=1547"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/1547\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/1576"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=1547"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=1547"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=1547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}