Explore Cosmos DB Flashcards
1
Q
What is cosmos DB?
A
- Fully managed NOSQL DB designed to provide low latency, elastic scalability of throughput, well-defined semantics for data consistency and high availability
2
Q
What are the benefits of cosmos DB global distribution?
A
- can achieve low latency by placing in the region closest to users
- can add or remove regions associated with an account at any time
- the app doesn’t need to be paused or redeployed to add or remove region
- every region supports reads and writes with 99.999% availability
- Guaranteed reads and writes served in less than 10ms at the 99th %tile
- CosmosDB internally handles the data replication between regions with consistency-level guarantees
- if one region goes down the others will pick up the load
3
Q
What is a cosmos DB account?
A
- Fundamental unit of global distribution and high availability
- contains unique DNS name
- managed via portal, CLI or SDKS
- can add or remove regions to your account at any time
- can create 50 accounts under a subscription
4
Q
What is a cosmosDB container?
A
- fundamental unit of scalability
- you can virtually have unlimited provisioned throughput (RU/s) and storage on a container
- ComosDB transparently partitions container using the logical partition key that you specify to scale your provsioned throughput and storage elastically
- container is a schema agnostic container of items
5
Q
What is the cosmos DB hierarchy?
A
- Accounts -> databases -> containers -> items (stored procs, functions, triggers etc)
6
Q
What is the defintion of a cosmosDB?
A
- unit of management for a set of azure cosmos DB containers
7
Q
How is a container partitioned?
A
- Horizontally partitioned and then replicated across multiple regions
- items you add to it are auto grouped into logical partitions which are distributed across physical partitions based on a partition key
- throughput is evenly distributed across physical partitions
8
Q
How is throughput on a container configured?
A
- Dedicated provisioned throughput mode; the throughput provisioned on a container is exclusively reserved for the container and its backed by the SLAs
- shared provisioned throughput mode; containers share the throughput with other containers in the same DB
9
Q
What is a cosmosDB item?
A
- depending on which API you use an item can be a doc in a collection, a row in a table or a node or edge in a graph
- can have arbitrary schemas
- by default all items that you add to a container are automatically indexed without requiring explicit index or schema management
10
Q
How does cosmosDB approach data consistancy?
A
- As a spectrum of sources
- strong consistency and eventual consistency are at the ends of the spectrum
- the further away from strong you are the higher availability, lower latency and higher throughput you will have
- region agnostic
- CosmosDB guarantees that 100% of read requests meet the consistency guarantee for the consistency level chosen
11
Q
What are the levels of data consistency?
A
- strong
- bounded staleness
- session
- consistent prefix
- eventual
12
Q
How can consistency modals be used?
A
- each one can be used for specific real-world scenarios
- you can configure detail consistency level on your azure cosmos DB account at any time
- it applies to all cosmos DB databases and containers under that account
13
Q
What is the strong consistency level of data consistency?
A
- offers linearizability (serving requests concurrently) guarantee
- reads are guaranteed to return the most recent committed version of an item
- client never sees an uncommitted or partial write
14
Q
What is the bounded stalness level of data consistency?
A
- reads are guaranteed to honour the consistent-prefix guarantee
- might lag behind writes by at most X versions (updates) of an item by Y time interval, whichever is reached first
- X and Y are staleness
- for single region min value of x and y is 10 write operations or 5 seconds
- for multi region min values are 100k and 300s
15
Q
what is the session consistancy level of data consistency?
A
- within a single client session reads are guaranteed to honour the consistent-prefix, monotonic reads, monotonic writes, read-your-writes, and write-follows-reads guarantees
- assumes a single writer session or sharing the session token for multiple writers