Book a Demo Free Trial

Improve performance & scalability of Azure Cosmos DB SQL API

Modhana Priya

Apr 28, 2022

Category: Azure Cosmos DB

We are already into an era that is experiencing a significant transformation in terms of application development. Nowadays, any application needs to be interactive, which makes real-time data management considerably harder. Relational databases could not meet those new requirements, so NoSQL databases became inevitable among large enterprises.

As a NoSQL database, Microsoft Azure Cosmos DB allows you to store vast volumes of semi-structured data without any predefined schemas, provides automatic scaling, easy data retrieval, and more.

Capabilities that make Cosmos DB stand out from other database services

  • Global data distribution: Manage the data even if stored in different datacenters across other Azure regions.
  • Multi-model support: Cosmos DB currently supports five types of APIs to let you store and process data– Cosmos DB SQL API, Cassandra API, Gremlin API, Table API & Cosmos DB API for MongoDB.

Every API has its purpose, but in this blog, we will primarily focus on Cosmos DB SQL API that stores data in JSON documents and queries the same through the SQL API.

Optimize the performance and scalability of Cosmos DB SQL API

Better the management of the data, better the performance of the database. And for that, we already have Cosmos DB explorer available in the Azure Portal exclusively for management.

  • It lets you view the data, run queries, store procedures, trigger, and view their results.
  • Sharing the query results is possible using the Cosmos DB Explorer.
  • Grant read or read-write access to your database for those who don’t have access to the Azure portal or subscription.

However, Cosmos DB Explorer only provides basic management features, so it is advisable to use external tools like Cerebrata to manage Cosmos DB SQL APIs. Despite Cosmos DBs’ in-built ability to auto-scale, improving their performance requires extra effort.

Streamline Cosmos DB SQL API management with Cerebrata

So, this blog describes three critical features of Cerebrata, which will assist you with inefficient and secure handling of Cosmos DB SQL APIs.

Document Analytics for Cosmos DB SQL API

Cosmos DB allows storing a massive amount of data and uses partitioning to scale containers to meet the performance needs. Any Cosmos DB container will have physical partitions (the count depends on the throughput and the total data stored), which will, in turn, have a range of logical partitions by grouping the items or documents that have the same partition key. So, it would not be easy to manage or visualize the data stored in each of those logical partitions.

Cerebrata comes into play with the Document Analytics feature for Cosmos DB SQL API containers to provide you with more visibility on the documents stored. Document Analytics aims to give an overview of the total size of the documents in each logical partition of a Cosmos DB SQL API container. The information is presented in charts that are easy to understand.

Azure cosmos db core sql api

The data stored in individual partitions can be visualized based on criteria like document size and count, with additional functionality for quickly retrieving the modified ones within a specific timeframe.

Managing SQL Queries

When using Cosmos DB targeting SQL APIs, retrieving data requires the use of long SQL queries. And manually writing it can be a cumbersome and time-consuming task. If you are someone familiar with SQL, then the process will be super-easy, but if not, then writing new queries each time is not recommended.

That is where Cerebrata’s built-in Query Manager makes a significant difference! You no longer need to write new queries; instead, build an initial query and save them for later use within the Query Manager; you can also export them as JSON files. It is one of the most valuable features from Cerebrata when it comes to Cosmos DB SQL APIs.

Managing SQL Queries

Transfer data from Storage Table to Cosmos DB SQL API container

This transfer is not a direct comparison between Storage Table and Cosmos DB SQL APIs, but there are a few areas where Cosmos DB containers have the upper hand. For instance, throughput on Table Storage is limited to 20,000 operations per second, but on Cosmos DB, more than 10 million operations per second are supported.

So many users try importing data from Storage Table to Cosmos DB SQL API containers. You can use an open-source tool (Data Migration tool) for small migrations; however, the tool is not suitable for migrating a large amount of data.

At this point, Cerebrate can be considered, and the steps are pretty simple where you have to fetch entities from the Storage Table and convert those into documents, then upload them in batches into the Cosmos DB containers.

Azure cosmos db core sql api

Besides this, you can also transfer documents from one container to another in the same or a different Cosmos DB SQL APIs.

Notable features of Cerebrata for Cosmos DB Management

Here, we’ve listed down the notable features of Cerebrata for Azure Cosmos DB Management,

  • Cerebrata supports managing multiple Cosmos DB APIs under one roof.
  • It helps perform CRUD operations on databases, containers, stored procedures, functions, and triggers without a hitch.
  • For documents stored, you can easily query them, insert a new document, and update and delete the existing ones.
  • Download the documents in your Cosmos DB in the JSON format for offline use.
  • Execute bulk operations and facilitate data transfers between Cosmos DB accounts.

There are also various other enterprise-grade Azure monitoring tools in the market that can be used to monitor the health and performance of various Azure services.

Conclusion

The blog explored an Azure management tool (Cerebrata) to overcome the hurdles in managing the Cosmos DB SQL APIs and the stored data, ultimately improving the database performance. On top of the unique management features, Cerebrata is a cross-platform tool that you can download and use on any platform of your choice – Windows, Mac, or Linux.