Again, still we have a lot of information we can spread our knowledge on it for Cosmos DB today I will talk about Cosmos DB API options and How I can choose between them and what is the key factor I should consider it when I choosing the Cosmos DB API. IF you don’t read my last articles in Azure Cosmos DB so here is your road map to learn Cosmos DB:
- Part 1 (Azure Cosmos Database Basics)
- Part 2 (Partitioning Architecture in Azure Cosmos DB)
- Part 3 (Azure Cosmos DB Global data distribution Architecture)
- Part 4 (Consistency Architecture in Azure Cosmos DB)
What is Cosmos DB
- Cosmos DB is Microsoft’s globally distributed, multi-model database service
- Cosmos DB enables you to Scale-Out in multiple Azure regions worldwide
- Cosmos DB Provide users around the world fast access to data with low latency for reading and write
- Cosmos DB provides a scalability solution to read and write option in multiple regions
- Cosmos DB Provide 5 level of Consistency (Strong, Bounded staleness, Session, Consistency prefix, Eventual)
- Cosmos DB has two kinds of Partitioning Logical and Physical
- Cosmos Database Supported multiple API (Core SQL, Mango DB, Cassandra, Gremlin (Graph), Azure Table)
Cosmos DB API
The first information you should know it that API configured on Account level not in Container So in case If you created Cosmos DB Account with SQL API this means any container will be created on this Cosmos DB account will be working on SQL API and this configuration can not be changed after creating it.
Core (SQL) API
This API called SQL but it is not SQL it is like SQL, it is document data model enable you to store your data in a document store, and it will use JSON for storing the data in a document, but why it is called SQL API because it gives you the ability to write SQL Query to manage the database.
Mongo DB API
It is also a document data model supporting you to store your data in the document store but this API Supporting Mongo DB with Full compatibility with Existing Mongo DB. SO if you are building your APP from Scratch Microsoft recommends you select SQL API but if you already have an Application or system built on Mongo DB at this time your choice it Mongo DB API.
Cassandra API is Column Family Data Model and this different than SQL API or Mongo API and Column Family technology in Cassandra is something like a table in Relational Database Like SQL Server, With Cassandra API you will have the ability to use Cassandra Query language, So if you have a system already built on Cassandra and you need to move it to Azure Cosmos DB so Cassandra API is your choice.
Azure Table API
Azure table API is a key-value data model or it called A key-value store or key-value database and this used to store something like URL in this key-value that pointed on your data that is saved on something like Azure Blob Storage and this URL can be user preference for document or image and with Key-Value Store there is no query language when you choose Table API if you already have table designed and you need to move it to Azure Cosmos DB at this time Azure Table API is your choice but if you are building your system from Scratch Microsoft recommend to use SQL API.
Gremlin (Graph) API
Gremlin API or Graph API is graph Database (GDB) is NoSQL Database and this the best choice when you have a system built on relationships between different points of data and with GDB Database we are using a technology called node table and edges tables and this feature supported in SQL Server 2017 For more information Check SQL Graph Architecture and this technology used for some websites like Amazon and Netflix that give you a recommendation based on your search and this is the relationships between different points of data So if you looking for graph data modeling Gremlin API is the best choice for you in this case.
Choosing the right data Store
- IF you are looking to store your data in the document your choice is SQL API or Mongo API.
- IF you are looking to store your data in Column Data Model or your System built on Cassandra so your choice is Cassandra API.
- IF your System builds on Azure table your choice is Azure table API or if you building your system from scratch your choice will be SQL API.
- If your system builds on relationships between different points your choice will be graph API.
Below Matrix can help you How you can choose the best API for your project.
Cloud Tech Website blog survey
IF you found this blog is helpful and sharing useful content please take few second to do rate the website blog from here