You can use Cosmos DB in scenarios which are highly distributed, mission critical, highly available, and easy to deploy. The following are the use cases offered by the Microsoft team:
- IoT
- Retail and marketing
- Gaming
- Web and mobile
Let's look over the use cases briefly.
IoT consists of various devices that emit data every fraction of a second. This places a need for high ingestion from multiple sources. Azure IoT hub can be used to receive the data from various IoT devices.
Once the data is ingested, you can use Azure HDInsight to process and derive real-time insight. You can then store this data in multiple sources, such as tables, to view in SaaS-based applications, DocumentDB to process the data for graphs and processing, and so on.
Let's look over the next use case.
Microsoft uses Azure Cosmos DB in the Microsoft e-commerce platforms Windows Store and Xbox Live. Azure Cosmos DB can be used to store product data, search the products, and perform the session, which is very important for e-commerce applications.
Azure Cosmos DB can also be used for event sourcing using its own change feed functionality. Change feed provides the amazing event generation mechanism to handle micro service communication.
You can refer to the following diagram about micro service communication:
Change feed is a concept introduced by RethinkDB; Packt authored a book on this called Mastering RethinkDB.
Let's look at the next use case, which is my favorite one, gaming.
Games are highly mission critical and should be very much available at all times. That requires fast and highly available databases. Azure has already proved its worth in games such as Halo 5, The Walking Dead, and so on. Azure Cosmos DB performance can be used to handle millions of requests and to show real-time data feeds and social engagement.
Azure Cosmos DB provides an API that can be directly used in games, and with the help of database functions such as Hadoop, could be used for real-time analysis and feeds.
Let's look over the web and mobile use case.
Azure provides various sets of tools such as key value stores, traffic manager, gateways, and of course Cosmos DB. These can be used in building social media applications, news feeds, and mobile applications using various frameworks.
Azure machine learning and Hadoop can be used as well to generate personalization reports, feeds, and recommendations, which is an amazing part of any modern application. Since most of the data is stored in JSON, it can be communicated and parsed across various scenarios such as the frontend, mobile, backend, and database.