17
Cool NoSQL on Azure with DocumentDB Azure User Group Belgium

Cool NoSQL on Azure with DocumentDB

Embed Size (px)

DESCRIPTION

Presentation to my talk at Azure User Group Belgium - http://www.azug.be/events/2014-09-29---what-s-new-in-azure-and-documentdb

Citation preview

Page 1: Cool NoSQL on Azure with DocumentDB

Cool NoSQL on Azure with DocumentDB

Azure User Group Belgium

Page 2: Cool NoSQL on Azure with DocumentDB

Who am I

• Jan Hentschel• Senior Software Development Lead – Ultra Tendency UG

• @Horizon_Net• http://janatdevelopment.com• Microsoft MVP for Azure

Page 3: Cool NoSQL on Azure with DocumentDB

What Microsoft says about DocumentDBFully managed, scalable, queryable, schemafree JSON document service for modern application …

What?

Page 4: Cool NoSQL on Azure with DocumentDB

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

Page 5: Cool NoSQL on Azure with DocumentDB

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

Page 6: Cool NoSQL on Azure with DocumentDB

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

Page 7: Cool NoSQL on Azure with DocumentDB

What … tunable consistency?

Level Writes ReadsStrong Sync quorum writes Quorum readsBounded Async replication Quorum readsSession Async replication Session bound replicaEventual Async replication Any replica

Page 8: Cool NoSQL on Azure with DocumentDB

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

Page 9: Cool NoSQL on Azure with DocumentDB

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

Page 11: Cool NoSQL on Azure with DocumentDB

Resource addressing

• API URL:• https://{database account}.documents.azure.com

• Document Path:• /dbs/{database id}/colls/{collection id}/docs/{document id}

Page 12: Cool NoSQL on Azure with DocumentDB

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/

Page 13: Cool NoSQL on Azure with DocumentDB

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

Page 14: Cool NoSQL on Azure with DocumentDB

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

Page 15: Cool NoSQL on Azure with DocumentDB

Enough talk!Lets get our hands dirty

Page 16: Cool NoSQL on Azure with DocumentDB

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

Page 17: Cool NoSQL on Azure with DocumentDB

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