cool nosql on azure with documentdb
DESCRIPTION
Presentation to my talk at Azure User Group Belgium - http://www.azug.be/events/2014-09-29---what-s-new-in-azure-and-documentdbTRANSCRIPT
Cool NoSQL on Azure with DocumentDB
Azure User Group Belgium
Who am I
• Jan Hentschel• Senior Software Development Lead – Ultra Tendency UG
• @Horizon_Net• http://janatdevelopment.com• Microsoft MVP for Azure
What Microsoft says about DocumentDBFully managed, scalable, queryable, schemafree JSON document service for modern application …
What?
What DocumentDB really is
• Fully managed = Work on JSON data without managing VM or cluster infrastructure• Scalable = Runs on Azure • Queryable = JavaScript as a modern T-SQL• Schemafree = Document Store
What you need to know about document stores• It’s all about collections and documents
• A collection stores a bunch of documents• Documents are schema-free• You can put any kind of documents into one collection• It was never easier to store your cook recipes together with your financial
data
• And don’t try to use your “relational mind”!!!
What you also need to know
• Transactional support with ACID semantics• API exposed as REST over HTTP• All entities uniquely addressable by a logical URI
• Tunable consistency• Tune and trade off consistency through well defined levels to suit application
scenarios and performance needs• Consistency level can be weakened per read/query request
What … tunable consistency?
Level Writes ReadsStrong Sync quorum writes Quorum readsBounded Async replication Quorum readsSession Async replication Session bound replicaEventual Async replication Any replica
Some theory … with BASE in mind
• Eventual consistency• All changes will be propagated in some point in the future
• Quorum• Response after data is written on (replication_factor / 2 + 1) nodes
What’s important for a developer?
• JavaScript UDFs, Triggers, Stored Procedures• Language integrated transactions• The entire procedure is wrapped in an implicit ACID transaction• JavaScript exception results into aborting the transaction
• “document oriented” SQL grammar• REST/HTTP APIs and client SDKs• .NET, Node.js, JavaScript, Python• C++ and Java planned
• Asynchronous support for all operations
What’s the resource model like?
src: http://azure.microsoft.com/en-us/documentation/articles/documentdb-interactions-with-resources/
Resource addressing
• API URL:• https://{database account}.documents.azure.com
• Document Path:• /dbs/{database id}/colls/{collection id}/docs/{document id}
Current quotas
• # of stored procedures, triggers and UDFs per collection = 25• # of AND clauses per query = 5• # of OR clauses per query = 5• request size of document = 256Kb• request size of stored procedure, trigger and UDF = 256Kb
• For more see - http://azure.microsoft.com/en-us/documentation/articles/documentdb-limits/
What’s more important for a C# developer?• Support gateway and direct connectivity• Async APIs for all operations• HTTP and TCP transports available• POCOs, inherited document types and dynamics
LINQ!!!LINQ!!!LINQ!!!
The small print
It’s all sandboxed so …
… no imports are allowed… eval() is disallowed… execution is time boxed… resource governed for CPU, IO and memory
Enough talk!Lets get our hands dirty
When should you use DocumentDB
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• You want to use a SQL-like grammar
Last words
DocumentDB is still preview …
… expect some things to change… give feedback… SDKs open sourced through GitHub
Samples available here!
Watch out for CloudBrew on November 29th