Cosmos DB Flashcards

1
Q

Benefits of NOSQL

A

(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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are Cosmos DB capabilities?

A

(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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Cosmos DB Organization

A

Cosmos DB Account
Database
Container
Item(s)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 5 available DB APIs

A

(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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the entity and container for SQL?

A

Database/Container

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the entity and container for Cassendra?

A

Keyspace/Table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the entity and container for MongoDB?

A

Database/Collection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the entity and container for Gremlin?

A

Database/Graph

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Wha is the entity and container for Azure Table?

A

Not applicable (auto generated)/Table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Azure CLI to create a Cosmos DB

A

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?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a Request Unit?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the resources encapsulated in the RU?

A

Processing Power (CPU)
Memory
IOPS (inputs/outputs per second)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the characteristics of Provisioned CosmosDB

A

(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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Scaling in Cosmos DB

A

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!)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the serverless Cosmos DB features?

A

(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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the best practices for Cosmos DB

A

(1) Use a partition strategy to evenly spead througput on partitions
(2) Provision throughput at the container level for predictiable performance
(3) Use the serverless account for development
(4) Understand the link between consistency types and the amount of RU’s Consumed

17
Q

What are the consistency levels

A

(1) Eventual
(2) Consitent Prefix
(3) Session
(4) Bounded Staleness
(5) Strong

18
Q

Consistency

Provides no guarantee for order and that you would even see your own writes

A

Eventual

19
Q

Consistency

Guarantees that updates are returned in order

A

Consistent Prefix

20
Q

Guarentees that a client session will read it’s own writes

A

Session

21
Q

Guarantees that a read has a max lag and receive a fairly recent version

A

Bounded Staleness

22
Q

Guarantees that reads get the most receipt version on an item

A

Strong

23
Q

Consistency level for SQL API

A

Request specific level added to your query

Set at the Account Level

24
Q

Important

A

No Answer

25
Q

What types of partitioning concepts are there?

A

Logical
Physical
Partition Key
Replica Set

26
Q

What are the chararistics of a Logical partition

A

A logical partition is a set of items that share the same partition key.
A container can hasve a many logical partition keys as needed but each one is limited to 20GB of storage.
Logical partitions are managed by Cosmos DB (but governed by your partition key stategey)

27
Q

What are the chararistics of a physical partition?

A

A container that is scaled by distributiong data and througput across physical partitions and is manged by Azure Cosmos DB

28
Q

What are the characteristics of a partition key?

A

Managed by user and serves as the means of routing your request to the correct partition.
Made up of both key and value of the defined partition key
SHOULD BE A VALUE THAT DOES NOT CHANGE
Should have many different values represented in the container

29
Q

What are the characteristics of a replica set?

A

A physical partition contains **multiple replicas **of the data and enable your storage to be durable and fault tolerant.

30
Q

What are the Stategy Considerations

A

(1) Hot Partition
(2) Multiple transactions requires triggers or stored procedures
(3) Minimize cross partition queries for heavier workloads
(4) Decide on partition key stategey before creating container

31
Q

Incomplete

Server Side Programming with Cosmos DB

A