Microsoft aims to help you better manage your data with services like Azure Cosmos DB, a multi-model database service that transparently scales and replicates your data wherever your users are. Let’s take a closer look at this PaaS offering and how you can benefit from it.
A Definition of Azure Cosmos DB
Comos DB is a database service that is globally distributed. It allows you to manage your data even if you keep them in data centers that are scattered throughout the world. It provides the tools you need to scale both global distribution pattern and computational resources, and these tools are provided by Microsoft Azure.
It can support multiple data models using one backend. This means that it can be used for document, key value, relational, and graph models. It is more or less a NoSQL database because it does not rely on any schemas. However, because it uses query language similar to SQL and can easily support ACID transactions, some people have been classifying it as a NewSQL type of database. What differentiates it from other NewSQL databases, however, is that it does not have a relational data model.
What Problem Does It Solve?
Traditionally, it would take you a long time and a lot of tedious effort to build a similar globally distributed database that you would need to host on your own data centers, using your own connections and other resources. The planning in itself would deter most companies from even thinking about such a setup; many would think that it wouldn’t be worth the investment. What happens is that most companies would rather opt out of it than take advantage of the business and growth opportunities that such a database system can offer.
When cloud computing and platform-as-a-service came along, however, it became easier to come up with a globally distributed and scalable database for your company. So easy that it is possible for just one person to architect and manage it just with a few clicks of the mouse. Azure Cosmos DB takes it to the next level, giving you a turnkey database system that you can scale according to your needs.
In sum, it will help any enterprise establish a flexible database that would help them meet their business needs. But it is especially useful for companies that are looking for a database system that is scalable and globally distributed. Globally distributed means that all resources are partitioned horizontally in every region of the world, as well as replicated across different geographical areas. That means latency is at a minimum, and your users have a faster, seamless experience. Azure Cosmos DB offers 99.99% availability.
Users also get to reap the benefits of several other features including:
- Complete service and ready to use: It gives you a complete product that is powered by Azure and can be automatically replicated in data centers worldwide.
- A number of consistency levels: It uses five different consistency levels: bounded staleness, strong, session, eventual, and consistent-prefix.
- Latency: Very low latency is practically guaranteed at less than 10 milliseconds when reading data and less than 15 milliseconds when writing data.
Benefits of Azure Cosmos DB
For one, you will not only have an easier time creating and managing a database system that is located in different parts of the world, it is also scalable, reliable, and highly available.
You can now use MongoDB APIs to access your database, as well as SQL, Azure Tables, and Gremlin. This means you are no longer limited to just one platform and you gain all the tools that you need. You can also enjoy the features (including the tunable consistency levels) that you have adored with DocumentDB, which is what Azure Cosmos DB is based on. The fact that it offers five consistency models is another plus. Most other database systems only offer two: eventual consistency and strong consistency.
There are a lot of competitors and that includes the database service offerings from the world’s most respected and biggest companies. The competition includes Google Cloud Platform, Azure Functions, and similar PaaS offerings. Google also has the Cloud Spanner, which was launched only recently. Amazon’s offering in this space is Amazon DynamoDB, a NoSQL database service that’s fast and flexible. And of course, Azure Cosmos DB also competes with traditional database firms such as Oracle.
As it’s a PaaS offering, there will be more features introduced in the future, meaning you get a turnkey product that promises continuous improvements with additional applications and features over time. Pricing is based on the storage used and the data throughput:
Data throughput is measured by the reserved request units per second. You would need to pay $0.008 per hour. Meanwhile, you also need to pay 25 cents per GB used per month.
Add-on provisioning is also available with CosmosDB’s opt-in Provisioned Request Units per Minute feature. This allows you to consume a bucket of requests on a per-minute basis (UTC), capped at 1,000 Request Units per Minute for every 100 provisioned throughput units per second. For this service, you’ll pay $0.0277/hr for each unit (Reserved RUs / minute (per 1,000 RUs)).
For the sake of comparison, let’s look at pricing models for one of Azure CosmosDB’s biggest competitors: Amazon DynamoDB. With DynamoDB, you pay only for the throughput and storage you need, and there’s a free tier offering “enough throughput to handle up to 200 million requests per month (25 write capacity units and 25 read capacity units).” You also get 25GB of indexed data storage and 2.5 million read requests per month from DynamoDB Streams.
Beyond the free tier, DynamoDB pricing is as follows:
- Provisioned Throughput (Write): As low as $0.47 per WCU (One write capacity unit (WCU) provides up to one write per second, enough for 2.5 million writes per month)
- Provisioned Throughput (Read): As low as $0.09 per RCU (One read capacity unit (RCU) provides up to two reads per second, enough for 5.2 million reads per month)
- Indexed Data Storage: As low as $0.25 per GB (DynamoDB charges an hourly rate per GB of disk space that your table consumes)
The key takeaway is that Microsoft Azure ensures that your data gets there, gets there fast, and at a reasonable price point. Microsoft says that it’s potentially five to ten times more affordable than other services out there. It’s definitely more cost-effective than DynamoDB when it comes to high volumes of workloads.
We’re fans of Microsoft Azure due to its ease of use, scalability, and other features (we’ve been using it ourselves for the past five years). But cloud hosting isn’t without its challenges; that’s why we build tools to help developers better monitor apps in Azure and other cloud services.
Additional Resources and Tutorials
For more information and some helpful tutorials, check out the following resources:
- Microsoft Documentation
- Table API Tutorial on GitHub
- DocumentDB API Tutorial on GitHub
- Build a MongoDB API console app with Golang and the Azure portal
- Azure Cosmos multimodel database delivers features familiar and new
- Build A Task-Based MongoDB Web App With .NET & Azure Portal