DXfoto.com - Fotolia

Tip

Get to know Microsoft Azure Cosmos DB use cases

Organizations can deploy Cosmos DB for a range of important applications. Learn how to bolster Azure workloads with this Microsoft database service that is highly distributed and multi-model.

Microsoft Azure Cosmos DB is a scale-out, operational database fabric that suits read-heavy apps, workloads that need to scale geographically and use cases where the application requires multiple data models.

Microsoft designed Cosmos DB to be simpler for application developers, in some ways, than competing services such as Amazon DynamoDB. It supports a variety of database types, including key-value stores, graph, document stores, time series and relational. On AWS, Google Cloud Platform and other public platforms, developers must choose different cloud database services for different data types. 

Cosmos DB can also automatically generate a database index without the user putting together a schema upfront. However, developers still need to select the consistency model, the level of scalability and the appropriate API for data storage.

In this piece, review the service's fundamentals, including its architecture. Learn some common Cosmos DB use cases that enterprises can compare to their applications' needs. And assess integrations with other Azure and third-party offerings, and the several scenarios where an enterprise should select another database service instead of Cosmos DB.

Microsoft Azure Cosmos DB
Timeline of Azure Cosmos DB

Scale-out vs. scale-up databases

Microsoft Azure Cosmos DB's main innovation is its scale-out architecture, which provides a data fabric as a service in a way that is easy to grow and manage -- and can work with various data types. Azure can add and remove servers to support a Cosmos DB app so that it can automatically grow and shrink. Across the Azure footprint, users can move data close to users as the service scales out, providing a high level of availability and reducing transaction latency to as low as single-digit milliseconds.

However, there are downsides to scale-out database architectures. They rely on multiple sources of truth, synchronized to varying levels of consistency. They also require complicated orchestration to ensure two users cannot write different things into the same record.

You're no longer limited to a specific database model, you're able to combine database models freely such as graph, document and SQL in a single environment.
James Fordsolutions expert at Intact Partners

Databases built on SQL use a scale-up paradigm, so the centralized database server needs to be expanded with demand. This kind of capacity growth requires more planning and administrative overhead and limits the usable data types. The main benefit of SQL databases is that they are fast at writing data and are always consistent, since there is a single source of truth. This also makes them easier to backup and restore to any single point in time. The tradeoff is clear: the higher the consistency, the slower the performance.

Microsoft tried to address some scale-out shortcomings with Cosmos DB. Previously, developers had to decide on the data consistency model for their application at the database level, said James Ford, solutions expert at Intact Partners, a Microsoft Cloud Solutions Provider. If certain fields required high consistency, that rigor had to be applied to the entire database, which significantly affected costs. With Cosmos DB, developers can pick and choose which fields should have strong consistency and which are less of a priority.

Multi-model support

Developers can use Microsoft Azure Cosmos DB for any database requirement, because it's a multi-model database.

"You're able to combine database models freely, such as graph, document and SQL in a single environment," Ford said.

Cosmos DB separates databases by logic, which enables more flexibility and lower costs than with physical infrastructure segmentation. Logic-based organization also makes it easier to consolidate datasets. This setup means companies can consider organic growth a Cosmos DB use case: As businesses grow, they tend to build applications in silos, where each one requires its own database infrastructure. Cosmos DB can bring those databases into a single instance, reducing costs and maintenance for database administrators and developers, while still enabling each application to run independently, Ford said.

A multi-model approach also makes it easier to create applications that require cross-referencing between different data types. Consider Cosmos DB for uses like catalog and inventory data, where the design allows for customization of specific details for single and shared items, said Shayne Sherman, CEO of TechLoris, an IT consulting service.

Cosmos DB use cases for Azure environments

One of the primary benefits of cloud-native databases is simple integration with other services on the same platform. These three Cosmos DB use cases illustrate how enterprises can incorporate the database service with other Azure offerings.

1. SaaS applications

SaaS apps typically include complex views, product backlogs and global customer requests, Somisetty said. User experience formats such as JSON, product catalogs and session states must be accessible with low latency and strong consistency. To achieve low-latency writes and high-performance reads, keep data in globally distributed storage.

Azure Cosmos DB can store data in multiple regions, scale quickly and provide fast response times. It also has native integrations with Azure App Service, Azure Kubernetes Service, Azure Functions and Power BI, among other services, through built-in plugins. The plugins include tools to set up dependency maps and ways for developers to assess the health of the integrations.

2. Big data and advanced analytics

Businesses can push structured and unstructured data to Azure and keep it in large data stores. This data can be prepared and trained for models using Azure Databricks, then stored in Cosmos DB to support intelligent applications. Azure Cognitive Services is a good choice for AI applications, while Power BI is a fit for analytics, Somisetty said.

3. Sales and operations planning

Organizations are starting to use Cosmos DB for sales and operations planning, to improve demand forecasting, Alkhasov said. These implementations often integrate a cloud-based analytic stack that includes Cosmos DB, Azure Databricks and technologies like Power BI. The analytics tools extract pre-defined datasets from supply chain management or operations applications into Cosmos DB. Users can analyze that data in the multi-model database service more quickly than individually running the analytics against the applications themselves.               

Application use cases for Cosmos DB

Microsoft Azure Cosmos DB suits workloads that need to handle massive amounts of data, as well as reads and writes at a global scale, with near-real-time responses, said Kiran Somisetty, senior cloud solutions architect at NetEnrich, a cloud consulting service. Use cases range from IoT to retail, gaming, social, web and mobile applications.

IoT applications typically need to ingest bursts of data from sensors distributed across many locations. Cosmos DB pulls this data into a single logical store, which can be enriched for various types of analytics and reporting.

Retail and marketing applications can store catalogs and manage event data from order processing in Cosmos DB. Microsoft uses Cosmos DB internally to support Microsoft Store and Xbox Live. Cosmos DB use cases also extend to management of customer-generated data, such as blog posts, ratings and comments.

Gaming services can use Cosmos DB to dynamically share information between players located around the world. The scale-out database architecture means the service is able to manage the data in a way that keeps latency down to avoid lag.

Other integrations

Microsoft Azure Cosmos DB easily integrates with other types of NoSQL databases, and it supports APIs for SQL such as Apache Cassandra, MongoDB, Apache Spark and Azure Table. Via integrations, IT organizations can replace and consolidate these other types of databases into a single back end from Cosmos DB. Developers can also use drivers and other types of tools built for applications previously reliant on one of those other platforms. For example, an enterprise could reuse existing Jupyter notebooks built for Spark on top of Cosmos DB.

Cosmos DB supports a range of programming languages for integration and application development, including JavaScript, .NET, Java, Python and C#. Server-side scripts for processing data are written in JavaScript.

Cosmos DB's integrations facilitate the provisioning of an end-to-end, cloud-scale analytics stack at the click of a button, said Solomon Alkhasov, general manager at SparkBeyond, an AI platform provider. The APIs built into Cosmos DB simplify integration with HDInsight, an Azure analytics service, for Apache Pig, Hive and MapReduce jobs. It's also easy to plug into streaming frameworks like Spark or Databricks.

NoSQL databases
Compare NoSQL options

Select the right database service

Microsoft Azure Cosmos DB complements the company's Azure SQL Database, which is used for transaction processing systems for applications that are write-heavy; and Azure Data Lake Analytics, which is optimized for big data analysis.

Evaluators of Cosmos DB with a use case that requires low latency, especially when data must be shared among many users, will find it the better option over Microsoft's Azure Table Storage or Azure SQL Database, Somisetty said. For example, Azure SQL Database might process transactions faster, but users could encounter network delays if they're generating these transactions in another country. Cosmos DB can replicate the necessary data closer to that user than these other services can.

Azure SQL Database is likely a better fit for applications with high integrity requirements, since it can roll back a database to any single moment in time. Cosmos DB users can only roll the database back to a few set points in a day, which could result in the loss of data if the database was corrupted by a hacker or application failure.

Azure Table Storage or Azure Blob Storage better suit scenarios where the data is small and infrequently accessed from a single process, such as storing templates or metadata that guide the process, Somisetty said. Azure Cosmos DB would be relatively expensive for these kinds of use cases.

Next Steps

Microsoft builds distributed ledger for Azure SQL database

Dig Deeper on Cloud infrastructure design and management

Data Center
ITOperations
SearchAWS
SearchVMware
Close