Cosmos DB Flashcards
Benefits of NOSQL
(1) Fluid Schema
(2) Multiple Structures
(key value, graph, document, wide-column)
(3) Horizontal scaling
(4) Provides BASE
(Basically available software state, eventual consistency
(5) Non-normilized data
If transaction volumes are very high such as many thousand transactions per second, you should consider a distrubuted NOSQL
What are Cosmos DB capabilities?
(1) Provides extremely low latency (single digit milliseconds)
(2) Provides SLA for throughput, latency, availability, and consistency
(3) Support multi-region replication at any point
(4) Enables elastic scalability
(5) Pricing is for the throughput provision *
Additional features: Integrated analytics, region support, schema agnostic, automatic indexing and support for multiple SDK
There is a serverless approach in preview but for now the price is dependent on Throughput
Cosmos DB Organization
Cosmos DB Account
Database
Container
Item(s)
What are the 5 available DB APIs
(1) SQL
(stores data in JSON format)
(2) Cassendra
(Want to leverage the CQL Query Lanague, wide-column format, already using Cassendra)
(3) MongoDB
(Already using MongoDB, familar, and stores in JSON)
(4) Gremlin
(Graph database, Apache Tinerpop’s Gremlin language)
(5) Azure Table
(Experience with Azure Tables and need to migrate to Cosmos, familar with querying using OData or LINQ Queries
Use the SQL version if Cassendar, MongoDB, or Gremlin fit your needs)
What is the entity and container for SQL?
Database/Container
What is the entity and container for Cassendra?
Keyspace/Table
What is the entity and container for MongoDB?
Database/Collection
What is the entity and container for Gremlin?
Database/Graph
Wha is the entity and container for Azure Table?
Not applicable (auto generated)/Table
Azure CLI to create a Cosmos DB
Resource Group
az group create –name $rgname –location $location
Create a DB Account with SQL API
az cosmosdb create –name $acctname –resource-group $rgname
Create a SQL Database
az cosmosdb sql database create –account-name $acctname –name $db
Create the Container
az cosmosdb sql container create –resource-group $rgname
–account-name $accountname –database-name $db –name $containername
In the Portal, you can create your own partition key. Not sure if CLI has this option?
What is a Request Unit?
A Request Unit encapsulates many of the resources needed for a the database into a single unit.
As a baseline, one RU equals one 1kb item read operation
What are the resources encapsulated in the RU?
Processing Power (CPU)
Memory
IOPS (inputs/outputs per second)
What are the characteristics of Provisioned CosmosDB
(1) Ideal for production
(2) Can be configured at database or container level
(3) Throughput evenly distributed to partitions
(4) Requires 10 RU’s per GB of storage
(5) Once RU’s have been reached, future requests are rate limited
If limited reached, responses show incomplete message
Scaling in Cosmos DB
Scaling is manual and is recommended to set an alert when reaching your limit
Autoscaling is available, you can specify a maximum amount. The minimum throughput is calculated as 10% of the maximum. (You do not want to set to high and pay for throughout not using!)
What is the serverless Cosmos DB features?
(1) Pay for what you consume and store
(2) ideal for development
(3) Max 5000 RU’s
(4) Requires a new Account Type
(5) Only supports SQL API