{"id":8726,"date":"2024-09-25T07:00:31","date_gmt":"2024-09-25T14:00:31","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=8726"},"modified":"2024-09-20T12:23:27","modified_gmt":"2024-09-20T19:23:27","slug":"announcing-cost-and-performance-improvements-with-azure-cosmos-dbs-binary-encoding","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/announcing-cost-and-performance-improvements-with-azure-cosmos-dbs-binary-encoding\/","title":{"rendered":"Announcing Cost and Performance Improvements with Azure Cosmos DB&#8217;s Binary Encoding"},"content":{"rendered":"<p><span style=\"font-family: arial, helvetica, sans-serif;\">We are excited to announce a significant enhancement to Azure Cosmos DB, bringing substantial cost savings and performance improvements to our users. The new binary encoding feature is now available for new containers and will soon be available for existing ones.<\/span><\/p>\n<h2><span style=\"font-family: arial, helvetica, sans-serif;\">What is Binary Encoding?<\/span><\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">Binary encoding converts JSON or other text-based data formats into a compact binary representation. Instead of storing data as human-readable text, it stores it as a sequence of bytes, which takes up less space and can be processed more quickly by computers.<\/span><\/p>\n<h3><span style=\"font-family: arial, helvetica, sans-serif;\">Key Benefits<\/span><\/h3>\n<ol>\n<li><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Storage Savings:<\/strong> With binary encoding, you can expect an average 20% reduction in documents size, but up to 70% for large documents with a substantial number of nested objects and arrays. This means you can store more data without increasing your storage.<\/span><\/li>\n<li><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Enhanced Performance for Large Queries:<\/strong><strong> The<\/strong> new binary encoding feature is especially beneficial for queries with aggregations or those that return large result sets, where performance improvements are most noticeable. This makes it an ideal solution for applications that demand <span data-teams=\"true\"><span class=\"ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak\" dir=\"ltr\">high throughput <\/span><\/span>and low latency.<\/span><\/li>\n<\/ol>\n<h2><span style=\"font-family: arial, helvetica, sans-serif;\">When will it be available<\/span><\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">Binary-encoding is automatically enabled for all new Azure Cosmos DB containers \u2013 for both new and existing database accounts. Existing containers will be automatically re-encoded over several months, starting in 2025.\u00a0 It is expected that customers monitoring their containers sizes to see storage metrics decrease when re-encoded. No action is required from users; and there will be no database service interruptions. You will receive a follow-up email notification for when existing containers are to be re-encoded.<\/span><\/p>\n<h2><span style=\"font-family: arial, helvetica, sans-serif;\">Performance Improvements<\/span><\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">All existing SDKs are supported, and no application changes are required. However, there are incremental performance benefits when using new SDKs. The next versions of our SDKs will start to implement optimizations that will extend performance improvements, stay tuned in our next releases. You can check the impact of binary encoding in some query examples in the table below.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/Screenshot-2024-09-20-102832.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8727\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/Screenshot-2024-09-20-102832.png\" alt=\"Image Screenshot 2024 09 20 102832\" width=\"1888\" height=\"517\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/Screenshot-2024-09-20-102832.png 1888w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/Screenshot-2024-09-20-102832-300x82.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/Screenshot-2024-09-20-102832-1024x280.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/Screenshot-2024-09-20-102832-768x210.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/09\/Screenshot-2024-09-20-102832-1536x421.png 1536w\" sizes=\"(max-width: 1888px) 100vw, 1888px\" \/><\/a><\/span><\/p>\n<h2><span style=\"font-family: arial, helvetica, sans-serif;\">Conclusion<\/span><\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">We are thrilled to bring this new feature to our Azure Cosmos DB users. The binary encoding feature is part of our larger commitment to provide the best possible performance and cost-efficiency for our customers. Customers can achieve even greater perf\/cost efficiency when combining this with <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/reserved-capacity\" target=\"_blank\" rel=\"noopener\">Reserved Capacity<\/a><\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">Stay tuned for more updates and enhancements as we continue to innovate and improve Azure Cosmos DB.<\/span><\/p>\n<h2><span style=\"font-family: arial, helvetica, sans-serif;\">FAQ<\/span><\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Question 1:<\/strong> How does this impact Azure Cosmos DB\u2019s document size limit?<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Answer<\/strong>: Azure Cosmos DB will encode your documents before checking its size, meaning that documents bigger than 2 MB may be ingested because their encoded size is smaller than 2 MB.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Question 2<\/strong>: Is there a benefit for Write operations?<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Answer<\/strong>: Yes. The smaller your documents are, the fewer RU\/s are used.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Question 3<\/strong>: In the future, after my data is encoded, will I be able to reduce RU\/s?<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Answer<\/strong>: Probably. You can check your new RU\/s and GBs usage and, aligned with <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/merge?tabs=azure-powershell%2Cnosql\" target=\"_blank\" rel=\"noopener\">Merge<\/a>, you will be able to reduce the provisioned Throughput.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Question 4<\/strong>: Is there any change in the format of the data?<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Answer<\/strong>: Yes. Trailing zeros are removed, so 1.0 becomes 1 as it was an integer. And integers beyond integer 64-bit limit will be converted to double precision floating point. If you don\u2019t want this conversion, you can represent those huge integers as string and then convert them into a <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/nosql\/query\/computed-properties?tabs=dotnet\" target=\"_blank\" rel=\"noopener\">computed column<\/a> in your queries.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Question 5:<\/strong> Which SDKs provide the best performance optimization?<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Answer: <\/strong>Next releases of .NET and JAVA SDKs will provide the best performance. Currently, the last .NET SDK version has implemented partial improvements. Please keep track of the next releases to check the implementation of binary encoding optimizations. Other languages SDKs will implement optimizations in the future, please check the roadmap of them.<\/span><\/p>\n<h2><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>Leave a review<\/strong><\/span><\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">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>.<\/span><\/p>\n<h2><span style=\"font-family: arial, helvetica, sans-serif;\"><strong>About Azure Cosmos DB<\/strong><\/span><\/h2>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\">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.<\/span><\/p>\n<p><span style=\"font-family: arial, helvetica, sans-serif;\"><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>.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are excited to announce a significant enhancement to Azure Cosmos DB, bringing substantial cost savings and performance improvements to our users. The new binary encoding feature is now available for new containers and will soon be available for existing ones. What is Binary Encoding? Binary encoding converts JSON or other text-based data formats into [&hellip;]<\/p>\n","protected":false},"author":21894,"featured_media":8731,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12,17,15,14,13,818],"tags":[],"class_list":["post-8726","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcements","category-gremlin-api","category-mongodb-api","category-core-sql-api","category-news","category-query"],"acf":[],"blog_post_summary":"<p>We are excited to announce a significant enhancement to Azure Cosmos DB, bringing substantial cost savings and performance improvements to our users. The new binary encoding feature is now available for new containers and will soon be available for existing ones. What is Binary Encoding? Binary encoding converts JSON or other text-based data formats into [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/8726","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\/21894"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=8726"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/8726\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/8731"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=8726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=8726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=8726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}