In this course we will understand the core concepts and fundaments of Cosmos DB. Microsoft’s Azure Cosmos DB is a fully managed No-SQL database for new age and modern application development.
Why Cosmos DB?
Initially, there we many challenges with the generic global distributed database as listed below.
- Long time of transaction.
- Lot of effort and maintenance were required.
- Businesses required their own infrastructure (Need to have to own data centers).
All these disadvantages were overcame with the arrival of Microsoft’s Azure DB.
How Cosmos DB evolved?
Key features of Cosmos DB
Below are the detailed features and advantages of Cosmos DB.
Few handpicked Cosmos DB implementation use cases
IOT based Implementation
Retail and marketing
Gaming industry
Web and mobile applications
Cosmos DB – Multi Model 5 APIs
There are four types of NoSQL databases namely Key – Value, Column – Family, Graph and Document. The Cosmos DB offers different API’s to support all of these NoSQL databases.
For example, the Cosmos DB provides Table API to support Key – Value, Cassandra API to support Column – Family, Gremlin API to support Graph and mongoDB API to support Document.
This means that with a single Cosmos DB account, you can run multiple database engines.
Key features of Cosmos DB Table API
• Key-Value store
• Premium offering for Azure Table Storage
• Existing Table Storage customers will migrate to
Cosmos DB Table API
• Row value can be simple like number or string
• Row cannot store object
Key features of Cosmos DB Cassandra API
Wide column No SQL Database
• Name and format of column can vary from row to row
• Simple migrate your Cassandra application to Cosmos Cassandra API and change connection string
• Interact
• Data Explorer
• Programmatically, using SDK (CassandraCSharpdriver)
Key features of Cosmos DB Gremlin API
• The Graph Data Model
• Real world data connected with each other
• Cosmos’s Graph database can persist relationships in the storage layer
• Graph traverse a language
You can use the above given APIs for different scenarios as listed below.
Azure Table storage vs Cosmos DB Table API
Azure Table Storage | Cosmos DB Table API |
Geo replication is restricted • Only 1 additional pair region | Geo replication across your choice of any number of regions |
Support for primary key lookups only | Secondary index support for lookups across multiple dimensions |
Lower performance • Throughput is capped • Latency is higher | Better performance ➢ Unlimited and predictable throughput ➢ latency is lower |
No consistency options | 5 consistency options |
How Cosmos DB Works?
Lets assume that you have a website that’s used by users across multiple geographic locations and the database writes are into the database located in North America region (in non-multi-master mode). This database is considered as a primary. When the data is written to the US North America, the users in the North America location will be able to get the data faster compared to other users in other geo locations due to network latency. If the multi-master feature is enabled, the data is concurrently written to all the selected regions simultaneously.
To solve these latency issues, the data has to be replicated to the user’s nearest region so that users can fetch the data faster from the nearest region. For example, if a user is located in Delhi, India, then this user should be able to access data from the Delhi region. Set up read databases in the nearest region of your users and replicate the data from the primary database to this secondary read database. When data is written to the primary database, the data is replicated to read databases, which are globally distributed.
Due to this architecture, the Cosmos DB overs the best results in terms of latency.
[…] What is Azure Cosmos DB | How it works? […]