Microsoft Azure: Document DBand othernoSQL databases
Benjamin Guinebertiere
Technical Evangelist, Microsoft France
@benjguin
noSQL matters on Azure
Other related managed services (PaaS)
Azure Search
Redis Cache
HDInsight : Hive + ORC Hadoop with Column
storage + SQL
SQL Database Elastic Scale Relational + Sharding
Managed databases (PaaS)
Azure Storage Tables Clef/valeur
HDInsight HBase Column
DocumentDB Document JSON
IaaS
MongoDB Document
In IaaS, or managed by MongoLabs,
or MongoDB
Cassandra Column
In IaaS, may be initiated thru the
Marketplace
Titan Graph
… Any database that installs on
Windows or Linux
DocumentDB
DocumentDB at Microsoft
user data store
{"id": "AzureDocumentDB","servicetype": "Data Platform","servicename": "Azure DocumentDB","releasetype": "Preview","public": true,"regions": [
{"name": "North Europe","visible": true,"capacity": 230034
},{
"name": "West US","visible": true,"capacity": 800034
},{
"name": "East US","visible": false,"capacity": 1000034
}]
}
{"id": "MS_125734","name": "John Macintyre","jobrole": "Program Manager","companyname": "Microsoft","photo": null,"bio": "John builds stuff at Microsoft.","topicids": [
"MS_Azure_12","MS_Azure_23","MS_Azure_44"
],"sessonids": [
"MS_TEE_DBIB318","MS_TEE_DBI212"
]}
designed, built and optimized for JSON
{ }JSON
schema-free and queryable
SQL
multi-document transactions
JS
tunable and fast
scalable and fully managed
{ }{ }
JS
JS
JS
The Basics
The Basics
Resource Model Entities addressable by logical URI
Partitioned for scale out
Replicated for HA
Entities represented as JSON
Accounts scale out through addition of capacity units
{ }{ }
JS
JS
JS
JSON + SQL
Query arbitrary paths,
properties and values
No secondary index
definitions required
Consistent Query Results in
the face of heavy writes
Query through SQL (or LINQ
in .NET)
JavaScript UDFs Extensibility
-- Nested lookup against index
SELECT B.Author
FROM Books B
WHERE B.Author.Name = "Leo Tolstoy"
-- Transformation, Filters, Array access
SELECT { Name: B.Title, Author: B.Author.Name }
FROM Books B
WHERE B.Price > 10 AND B.Language[0] = "English"
-- Joins, User Defined Functions (UDF)
SELECT CalculateRegionalTax(B.Price, "USA", "WA")
FROM Books B
JOIN L IN B.Languages
WHERE L.Language = "Russian"
The choice of consistency level has performance implications
for both write and read operations
• Write operations
• Consistency level changes impact request latency
• Stronger consistency levels result in higher write
latencies
• Read operations
• Consistency level changes impact throughput
• Weaker consistency levels result in higher read
throughput
Tip: You can lower the consistency level of a specific read or query request by specifying [x-ms-consistency-level] request header or by using RequestOptions in the SDKs
Document myDoc = await
client.ReadDocumentAsync(documentLink,
new RequestOptions
{ ConsistencyLevel = ConsistencyLevel.Eventual });
Lower consistency level on read operation
How it works
Automatic indexing of documents
JSON documents are represented as
trees
Structural information and instance
values are normalized into a JSON-Path
Example{"headquarters": "Belgium"} /"headquarters"/"Belgium"
{"exports": [{"city": “Moscow"}, {"city": Athens"}]} /"exports"/0/"city"/"Moscow"
and /"exports"/1/"city"/"Athens".
Configuration Level Options
Automatic Per collection True (default) or False
Override with each document write
Indexing Mode Per collection Consistent or Lazy
Lazy for eventual updates/bulk ingestion
Included and excluded
paths
Per path Individual path or recursive includes (? And *)
Indexing Type Per path Support Hash (Default) and Range
Hash for equality, range for range queries
Indexing Precision Per path Supports 3 – 7 per path
Tradeoff storage, query RUs and write RUs
Path Description/use case
/ Default path for collection. Recursive and applies to whole document tree.
/"prop"/? Serve queries like the following (with Hash or Range types respectively):
SELECT * FROM collection c WHERE c.prop = "value" SELECT * FROM collection c WHERE c.prop > 5
/"prop"/* All paths under the specified label.
/"prop"/"subprop"/ Used during query execution to prune documents that do not have the
specified path.
/"prop"/"subprop"/? Serve queries (with Hash or Range types respectively):
SELECT * FROM collection c WHERE c.prop.subprop = "value" SELECT * FROM collection c WHERE c.prop.subprop > 5
Transactionally
process multiple
documents with
application defined
stored procedures
and triggers
JavaScript as the procedural language
Language integrated
Execution wrapped in an implicit transaction
Preregistered and scoped to a collection
Performed with ACID guarantees
Triggers invoked as pre or post operations
Get started with Azure DocumentDBhttp://aka.ms/documentdb
DocumentDB Documentation, Videos & Tutorialshttp://aka.ms/documentdbdocs
Submit DocumentDB Feedback & Vote for Featureshttp://aka.ms/documentdbfeedback
Sample Codehttp://aka.ms/documentdbsamples
Team Bloghttp://aka.ms/documentdbblog
DocumentDB Resources
Other noSQL databases on Azure
tech.days 2015#mstechdays
Activez vos bénéfices Azure jusqu’à
115€ de ressources mensuelles
offertes
115€ /mois
x5 membres
x3 ans
= 4 175€ de ressources offertes
http://azure.com http://aka.ms/azurepourmsdn
150€ de ressources offertes
Sans engagement
Pour tousUn mois d’essai offert
http://www.microsoft.com/bizspark/
Pour les startupsBizspark
= 49 000€ de ressources offertes
pendant un an
Pour les abonnés MSDN
tech.days 2015#mstechdays
Inscrivez-vous : http://aka.ms/pepiniereazure
Coaching technique et business
Ressources
Une équipe à Microsoft pour vous accompagner dans votre projet cloud et mettre à
votre disposition de l’aide personnalisée.
Visibilité
Benjamin Guinebertière
Technical Evangelist, Microsoft FranceAzure, data insights, machine learning @benjguin | http://3-4.fr
Démo screen shots