Skip to content

CosmosDB: Is It a Good Alternative to Relational Databases?


Dec 7, 2020 - 4 minute read

1152 Blog Azure Cosmosdb 416X300
Sergiusz Wolewicz .NET Developer

He’s been a .NET developer since 2011, and a bot developer for the last 2 years. He holds a Master’s degree from the Wroclaw University of Technology. He likes reading, cycling, watching series, and video games.

See all Sergiusz's posts

HC NHS Survey Blog Ad


In the 21st century, information technologies are developing in a geometric progression—and, among other things, NoSQL databases have become quite popular. For reasons of cost, ease of maintenance, access, scalability, and more, many applications and IT systems are being moved to the cloud. NoSQL database solutions are also available in the cloud, one such solution is CosmosDB in the Azure cloud. But how will it perform in small projects?

What Is NoSQL?

The NoSQL database (as in “not only SQL”) is a database with flexible schemas unlike traditional relational databases. NoSQL databases have existed since 1960, but they’ve only become popular in the 21st century. The most popular types for NoSQL databases are document, graph, key-value, and column databases. It’s important to note that “No” means “not only”, because many NoSQL databases support a structured query language (SQL).

What Is Azure Cosmos DB?

Azure Cosmos DB is a globally distributed, and multi-model NoSQL database service with a transparent multi-master replication and turnkey global distribution. When used by Microsoft, it gets a single-digit millisecond read and write latencies at the 99th percentile. It gives you the possibility to scale at every moment and to match your needs. Whereas management on the Azure platform allows you to manage your databases from every place in the world; you only need an Internet connection.

Easy access to the database and different types of supported APIs make it possible to quickly and easily develop new applications or update the already existing ones. In fact, no schema enables you to project and develop databases faster and, through supporting multiple APIs, it also allows you to develop databases on different platforms.

Microsoft delivers an emulator of CosmosDB that can be downloaded for free which makes it possible to develop locally without bearing any costs.

Use Case

We created a chatbot called ‘Little Brush, Big Brush’ for our client Unilever, who teaches children to brush their teeth regularly. The chatbot is a Facebook bot that works on Messenger. Unilever has a separate bot for each country’s fan page. All fan pages have different content, posted in different languages. That’s why separate instances of the bot are released for each fan page, and each instance has its own CosmosDB.

Unilever decided to introduce a new bot functionality, but only on some of the environments. These changes mean that the structure of the data stored in CosmosDB will change. However, the elastic structure of CosmosDB allowed us to introduce changes without losing legacy data and to store new data in the same models. In this situation, we only needed to make changes to the code, which was fully compatible with the existing database. In addition, whenever you want to go back to the old version, changes in the database are also not required. This would be impossible in the case of a relational database, however, NoSQL makes it possible.

After some time, two of the bots began to respond quite slowly. We investigated this and found that it happened at the time when the bot was experiencing the highest traffic. The issue was with CosmosDB – there wasn’t enough RU/s (i.e. request units per second). Increasing the value of RU/s, solved the issue. To avoid this issue in the future, we created alert rules. These kinds of alert rules will let you know when to scale up your CosmosDB. At the moment, autoscaling is only possible on new databases and containers; that’s why we have to solve this problem in this way.

Unilever asked us to figure out a way to lower the cost of the environment. CosmosDB was one of the most cost-intensive tools we were using at the time. We combined all test environments on one CosmosDB, which allowed us to remove some of the databases. After analysing the number of active users, we decreased the RU/s on environments with low traffic, which has significantly reduced the costs. CosmosDB made this possible without having to delete the database or stop it from working.

At the time of the development of the solution, the auto-scale CosmosDB option wasn’t available. However, if we wanted to achieve a similar effect now, we could use auto-scaling to achieve even better results. With CosmosDB’s current features, we would be able to achieve more than the ability to control costs by setting the maximum performance of the application/database. When using auto-scaling, solutions can automatically adjust performance as needed. Auto-scaling allows you to manage your costs more effectively—and not only by defining the maximum level of the cost of the environment. It will also allow you to save an additional portion of your budget when the application is not being used.


Our example demonstrates that NoSQL isn’t as complicated as many people think, and that it can be used even in small projects. Its flexible structure enables you to easily create new databases or to change the structure of existing ones, without the need to conduct any additional operations. It’s accessible via the cloud, it’s easy to manage, to create new elements, or to edit existing ones. Whereas creating alert rules helps to catch critical issues. If you would like to try CosmosDB for the first time, you can use a free emulator, which doesn’t require any registration.

If you'd like to learn more about the cloud, download our "Cloud Done Right: Effective Cost Management" eBook.

HC NHS Survey Blog Ad
Sergiusz Wolewicz .NET Developer

He’s been a .NET developer since 2011, and a bot developer for the last 2 years. He holds a Master’s degree from the Wroclaw University of Technology. He likes reading, cycling, watching series, and video games.

See all Sergiusz's posts

Related posts

You might be also interested in


Start your project with Objectivity

CTA Pattern - Contact - Middle

We use necessary cookies for the functionality of our website, as well as optional cookies for analytic, performance and/or marketing purposes. Collecting and reporting information via optional cookies helps us improve our website and reach out to you with information regarding our organisaton or offer. To read more or decline the use of some cookies please see our Cookie Settings.