5. Consistency Levels
• Client always see completely consistent data
• Slowest read/write
• Applicable to areas: Airline / Banking / Stock Market
Strong
6. Consistency Levels
• Client reads its own writes, while other clients
reading this same date might see older values.
Session (default option)
7. Consistency Levels
• Client might see old data, but it can specify how old
that data can be, let’s say 3 seconds!
• Updates happen in order received
• Similar to Session consistency, but speeds up the
reads while still preserving the order of updates.
Bounded Staleness
8. Consistency Levels
• Client might see old data for as long as it takes a
write to propagate to all replicas
• High performance & availability
• Client might see updates out of order
Eventual
11. Resource Addressing
• Native REST Interface
• Each resource has a permanent unique ID
• API URL:
• https://{database account}.documents.azure.com
• Document Path:
• /dbs/{database id}/colls/{collection id}/docs/{document id}
12. Operations
For each Resource:
• Create / Replace / Delete / Read / Query
• Read is a GET operation on a specific resource ID, returning
a single resource.
• Query is a POST operation on a collection with a request
body containing DocumentDB SQL text, returning a possible
empty collection of resources.
• Query can filter on indexed properties.
13. Stored Procedures, Triggers and UDFs
• DocumentDB supports server-side JavaScript
• Stored Procedures:
• Registered at collection level
• Operate on any document in the collection
• Invoked inside transaction context on primary replica
• Triggers:
• Pre- or Post: create, replace or delete operations
• Invoked inside transaction context on primary replica
• User-Defined Functions:
• Scalar functions invoked only inside queries
14. Support
• .NET (LINQ to SQL is supported)
• Node.js
• JavaScript
• Python
• Java
• Hadoop
15. When should you use?
In General
• You don’t want to do replication and scale-out by yourself
• You want to have tunable consistency
• You want to do rapid development
Compared to relational databases
• You don’t want predefined columns Compared to other document stores
Compared to other document stores
• You want to use a SQL-like grammar
16. Pricing
• http://bit.do/documentdb-pricing
• Capacity Units (CU)
• Capacity
• Throughput (in terms of rate of transactions / second)
• Request Units (RU) = 2000 request per second
• “Request” depends on the size of the document
ex. Uploading 1000 large JSON documents might count as
more than one request
17. Limitations & Quota
Entity Quota (Standard Offer)
Database Accounts* 50
Maximum document storage per
database account*
1 TB (or higher by request)
Provisioned document storage* /
collection
250 GB (or higher by request)
Maximum Request Units / second per
collection
250,000 RU/s(or higher by request)
Maximum request size of document 512KB
Maximum execution time for stored
procedure and trigger
5 seconds
18. References
• DocumentDb CheatSheet
• http://bit.ly/documentdb-cheatsheet
• DocumentDB Query Playground
• http://bit.ly/documentdb-playground
• Visual Studio Dev Essentials
• http://bit.ly/vsdev-essentials