Cosmos DB Advantages

Cosmos DB is gaining Traction exponentially & I would like to list the advantages of Cosmos DB here.

Globally Distributed means scalable across all countries & regions.

Low Latency is the core advantage of Cosmos DB.  This is achieved through SSD based storage, planet scale flexibility providing Millisecond response time.

Flexible Consistency offered through Varying Consistency Models like Strong, Boundless, Session, Prefix, Eventual.

Flexible Pricing Model allows metering of storage & throughput independently rather than CPU/Memory/IOPs.

Elastic Scalability will scale the database based on the request volumes with No Limits. aka Horizontal Scalability

Multi-Storage Model allows storage of data in form of key-value pairs, documents, graphs & columnar

Multi-API Model allows querying the database in SQL for document, MongoDB for document, Azure Table Storage for key-value, Cassandra for columnar etc.

High Security  achieved through End-to-end Encryption on data-in-transit & data-at-rest.

Cosmos DB

In this article we can explore about Cosmos Db database & its usage.

Cosmos DB

Azure Cosmos DB is a globally distributed, multi-model, planet-scale, low-latency, high-availability, No-SQL database stored as JSON format.

image

In the olden days Cosmos DB was called as Azure DocumentDB.

Planet Scale

Azure Cosmos DB will be replicated based on Geography region & hence low-latency. There will be Primary Write-database in one central location & Multiple Secondary Read-databases in multiple locations.

Due to the multiple geographical location availability low-latency & high-availability is possible.

Multi-API Support

Cosmos DB supports Multiple-API support:

· SQL API

· Mongo API

· Graph API

· Table API

· Cassandra API

JSON Format

JSON Format is used to store the data in Cosmos DB.

Consistency

Cosmos DB have 5 consistency levels to ensure consistency, availability and latency trade-offs.

Create Cosmos DB

We can create Cosmos DB from Azure Portal as shown below.

Open Azure Portal > Create new resource > Cosmos DB

image

image

Click the Ok button & Wait for few minutes for the Creation to be completed.

You will get the following screen after creation.

image

Start by Add Collection. Then Add a New Document.

image

You can add new properties in the document. The data is stored as JSON file. Ensure the ID is unique.

image

Now we can query the database using SQL. Choose the New SQL Query option > Enter SELECT statement & Execute the Query. You will get the following results as displayed.

image

Summary

In this article we have explored about Cosmos Db database & its usage.

Azure Cosmos DB

Azure Cosmos DB provides a NoSQL database in Azure premises.  It is globally distributed, highly available, massively scalable database.  It is an extension of the previous DocumentDB which was used for storing databases.

image

Advantages

Following are the Advantages of Cosmos DB.

Scalability It is horizontally scalable

Globally Distributed It is available from multiple edge server end points reducing latency

Multi-Model It supports document, key-value & graph models

Multi-API It supports sql, mongodb, cassandra, azure table, gremlin apis.

Security It is fully & transparently encrypted

Create Cosmos DB

Open Azure Portal  > Search for Cosmos DB > Use Create Option as below.

image

Enter the details in appearing window.

image

You can access the same from Azure Cosmos DB tab from the left.

image

Development

Clicking on the Quick Start pane will give you the Development Code & Samples.

image