SlideShare a Scribd company logo
Schema Agnostic Indexing with
Azure DocumentDB
@dharmashukla, DocumentDB
Presented at VLDB 2015
Sudipta Sengupta, Justin Levandoski,
David Lomet
Microsoft Research
Dharma Shukla, Shireesh Thota, Karthik Raman,
Madhan Gajendran, Ankur Shah, Sergii Ziuzin,
Krishnan Sundaram, Miguel Gonzalez Guajardo, Anna
Wawrzyniak, Samer Boshra,
Renato Ferreira, Mohamed Nassar,
Michael Koltachev, Ji Huang
Microsoft Corporation
 Overview of DocumentDB
 Schema Agnostic Indexing
 Logical Index Organization
 Physical Index Organization
 Summary
Outline
 Fully managed, multi-tenant, geo-distributed document database service on
Azure
 Born out of the needs of internal Microsoft applications; GA since April 2015
 Built from the ground up with resource governance
 Provisioned throughput, performance isolation, OPEX efficiency
 Well defined consistency levels with predictable performance
 Database engine built for JSON & JavaScript
 Automatic indexing of JSON values and rich (SQL and JavaScript) query
 JavaScript language integrated transactions and query directly inside the database engine
What is DocumentDB?
Strong Bounded Staleness Session Eventual
Architecture
Database
Collection
Document
Account
User
Permission
JavaScript Object Literals
JSON serializable
values (aka JSON
Infoset)
{
"locations":
[
{ "country": "Germany", "city": "Berlin" },
{ "country": "France", "city": "Paris" }
],
"headquarter": "Belgium",
"exports":[{ "city": "Moscow" },{ "city": "Athens"}]
}
locations headquarter exports
0 1
country
Germany
city
Berlin
country
France
city
Paris
city
Moscow
city
Athens
Belgium 0 1
• Automatic indexing of document trees without
requiring schema or secondary indices
• SQL and JavaScript query processing on the trees
• Lazy materialization of JavaScript values from the
instances of trees
JSON document as tree
Schema-agnostic indexing
• Index is a union of all the document trees
Common
structure
• Structural information and instance values are normalized into a
unifying concept of JSON-Path
Terms Postings List/Values
$/location/0/ 1, 2
location/0/country/ 1, 2
location/0/city/ 1, 2
0/country/Germany 1, 2
1/country/France 2
… …
0/city/Moscow 2
0/dealers/0 2
0
Germany
location
0
location
country
0
country
Range (>, <, !=) &
ORDERBY queries
0
Germany
location
0
location
country
0
country
Wildcard queries Spatial queries
0
coordinates
Dynamic
Encoding of
Postings List
(E-WAH/differential)
Logical Index Organization
Query
{
"results":
[
{
"locations":
[
{"country":"Germany","city":"Berlin"},
{"country":"France","city":"Paris"}
]
}
]
}
{ "locations":
[ { "country": "Germany", "city": "Berlin" },
{ "country": "France", "city": "Paris" }
],
"headquarter": "Belgium",
"exports": [{ "city": "Moscow" }, { "city": "Athens" }]
}
{ "locations": [{ "country": "Germany", "city": "Bonn", "revenue": 200 } ],
"headquarter": "Italy",
"exports": [ { "city": "Berlin","dealers": [{"name": "Hans"}] }, { "city": "Athens" }
]
}
locations headquarter exports
0 1
country
Germany
city
Berlin
country
France
city
Paris
city
Moscow
city
Athens
Belgium
locations headquarter
0
country
Germany
city
Bonn
revenue
200
Italy
0 1
exports
city
Berlin
city
Athens
0
1
dealers
0
Hans
name
0
locations
0 1
country
Germany
city
Berlin
country
France
city
Paris
SELECT C.locations
FROM company C
WHERE C.headquarter = "Belgium"
results
Query result
Input documents
function businessLogic() {
var country = "Belgium";
__.filter(function(x){return x.headquarter===country;});}
SQL JavaScript
doc_id =5
key: “age/22”
payload: +doc5
key: “age/21”
payload: -doc5
key: “city/seattle”
payload: +doc5
key: “zip/98103”
payload: +doc5
…
Path/Posting List updates
Index
Query Processor
Indexscan > “age/30”
< “age/32”
doc1, doc5, doc7
System model for writes and queries
B-Tree
Cache
Log Structured Store
Index Maintanance Requirements
• Support sustained volume of rapid writes
without any term locality
• Queries should honor various consistency
levels
• Index maintenance must operate within
frugal resource budget
• Low write, read and space amplification
Page P
Page
ID
Physical
Address
P
Mapping Table
Δ: Insert record 50
Δ: Delete record 48
Δ: Update record 35 Δ: Insert record 60
Consolidated Page P
Update record 35 Insert record 60
HighlyConcurrentPageUpdatesHighly concurrent index updates
Base page
Log-structured Store on SSD
.
.
.
.
.
Mapping
table
Writeorderinginlog
Base page
Base page
-record
-record
(Latch-free)
Flush Buffer
(8MB)
.
.
Base page
-record
-record
RAM
-record
WriteOptimizedStorageOrganizationWrite optimized storage organization
• Little to no term locality on index write path
• Unable to keep “hot set” of leaf pages
cached in memory
• Performing read to modify each leaf node
leads to very high I/O overhead
• Requires method to maintain efficient write
path for sustained term ingestion with
predictable performance
update term t1
delete term t58
insert term t109
update term t179
update term t568
delete term t732
Lack of term locality
Blindupdates&ValueMerge
Address
Mapping Table
Log Structured Store (LSS)
T  {doc1, doc2, doc3, doc5}
Term T  -doc2
P
Read I/O
Page Stub
Address
Mapping Table
Log Structured Store (LSS)
Term T  +doc5
P
T->+doc2 T->-doc2
Page Stub
{doc1, doc2, doc3} {+doc5} {-doc2}
Term lookup or full
page consolidate
Page P
T  {doc1, doc2, doc3}
Add doc5 to posting list for term T
Page P
T  {doc1, doc2, doc3}
Page P
T  {doc1, doc2, doc3}
…
Consolidated Page P
T  {doc1, doc3, doc5}
Blind update for term T
Blind updates and value merge
0
2000
4000
6000
8000
10000
12000
14000
16000
18000
0 2000 4000 6000 8000 10000
NumberofIOs
Index Size (MB)
Update Blind Update
Summary

More Related Content

PDF
Cosmos DB at VLDB 2019
PDF
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
PPTX
Azure DocumentDB
PPTX
Cool NoSQL on Azure with DocumentDB
PPTX
Introduction à DocumentDB
PPTX
Azure doc db (slideshare)
PPTX
[PASS Summit 2016] Azure DocumentDB: A Deep Dive into Advanced Features
PPT
Mongo Bb - NoSQL tutorial
Cosmos DB at VLDB 2019
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
Azure DocumentDB
Cool NoSQL on Azure with DocumentDB
Introduction à DocumentDB
Azure doc db (slideshare)
[PASS Summit 2016] Azure DocumentDB: A Deep Dive into Advanced Features
Mongo Bb - NoSQL tutorial

What's hot (20)

PPTX
The CIOs Guide to NoSQL
PPTX
Agility and Scalability with MongoDB
PPTX
Azure CosmosDB the new frontier of big data and nosql
PPTX
Mongo db
PPTX
CouchDB
PPTX
An Introduction To NoSQL & MongoDB
PDF
Automating Research Data Flows with Globus (CHPC 2019 - South Africa)
PPSX
Microsoft Hekaton
PPTX
PPTX
No SQL, No Problem: Use Azure DocumentDB
PDF
Apache Spark and MongoDB - Turning Analytics into Real-Time Action
PPTX
Benefits of Using MongoDB Over RDBMSs
PDF
Apache CouchDB
PPTX
MongoDB Replication fundamentals - Desert Code Camp - October 2014
PDF
Performance comparison: Multi-Model vs. MongoDB and Neo4j
PDF
Globus Portal Framework (APS Workshop)
PPTX
Azure DocumentDB for Healthcare Integration
PPTX
When to Use MongoDB
PDF
Session #2, tech session: Build realtime search by Sylvain Utard from Algolia
The CIOs Guide to NoSQL
Agility and Scalability with MongoDB
Azure CosmosDB the new frontier of big data and nosql
Mongo db
CouchDB
An Introduction To NoSQL & MongoDB
Automating Research Data Flows with Globus (CHPC 2019 - South Africa)
Microsoft Hekaton
No SQL, No Problem: Use Azure DocumentDB
Apache Spark and MongoDB - Turning Analytics into Real-Time Action
Benefits of Using MongoDB Over RDBMSs
Apache CouchDB
MongoDB Replication fundamentals - Desert Code Camp - October 2014
Performance comparison: Multi-Model vs. MongoDB and Neo4j
Globus Portal Framework (APS Workshop)
Azure DocumentDB for Healthcare Integration
When to Use MongoDB
Session #2, tech session: Build realtime search by Sylvain Utard from Algolia
Ad

Viewers also liked (10)

PPTX
#PortraitDeCDO - Guénaëlle Gault - Kantar
PPTX
Real time machine learning
PDF
CAPとBASEとEventually Consistent
PDF
RDB技術者のためのNoSQLガイド NoSQLの必要性と位置づけ
PPTX
#PortraitDeCDO - Thierry Picard - Pierre Fabre
PDF
Time Series Analysis with Spark by Sandy Ryza
PPTX
#PortraitDeCDO - Laurent Assouad - Aéroport de Lyon
PDF
Nosqlの基礎知識(2013年7月講義資料)
PDF
Analyzing Time Series Data with Apache Spark and Cassandra
PDF
700 Queries Per Second with Updates: Spark As A Real-Time Web Service
#PortraitDeCDO - Guénaëlle Gault - Kantar
Real time machine learning
CAPとBASEとEventually Consistent
RDB技術者のためのNoSQLガイド NoSQLの必要性と位置づけ
#PortraitDeCDO - Thierry Picard - Pierre Fabre
Time Series Analysis with Spark by Sandy Ryza
#PortraitDeCDO - Laurent Assouad - Aéroport de Lyon
Nosqlの基礎知識(2013年7月講義資料)
Analyzing Time Series Data with Apache Spark and Cassandra
700 Queries Per Second with Updates: Spark As A Real-Time Web Service
Ad

Similar to Schema Agnostic Indexing with Azure DocumentDB (20)

PPTX
Introducing Azure DocumentDB - NoSQL, No Problem
PPTX
Webinar: General Technical Overview of MongoDB for Dev Teams
PPTX
Introduction to NoSql
PPTX
Introduction to RavenDB
PPTX
Webinar: From Relational Databases to MongoDB - What You Need to Know
PPTX
Conceptos básicos. Seminario web 1: Introducción a NoSQL
PDF
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
PPTX
Intro to RavenDB
PPTX
Python Ireland Conference 2016 - Python and MongoDB Workshop
PPTX
Mark Logic StrangeLoop 2010
PPTX
MongoDB by Emroz sardar.
PPT
Building Your First MongoDB App ~ Metadata Catalog
PDF
Realtime Indexing for Fast Queries on Massive Semi-Structured Data
PDF
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
PDF
An Introduction to Mongo DB
PPTX
No SQL - MongoDB
KEY
Seedhack MongoDB 2011
PPTX
TechEd AU 2014: Microsoft Azure DocumentDB Deep Dive
PPTX
A Presentation on MongoDB Introduction - Habilelabs
PPTX
Scaling MongoDB
Introducing Azure DocumentDB - NoSQL, No Problem
Webinar: General Technical Overview of MongoDB for Dev Teams
Introduction to NoSql
Introduction to RavenDB
Webinar: From Relational Databases to MongoDB - What You Need to Know
Conceptos básicos. Seminario web 1: Introducción a NoSQL
Elasticsearch - SEARCH & ANALYZE DATA IN REAL TIME
Intro to RavenDB
Python Ireland Conference 2016 - Python and MongoDB Workshop
Mark Logic StrangeLoop 2010
MongoDB by Emroz sardar.
Building Your First MongoDB App ~ Metadata Catalog
Realtime Indexing for Fast Queries on Massive Semi-Structured Data
OSDC 2012 | Building a first application on MongoDB by Ross Lawley
An Introduction to Mongo DB
No SQL - MongoDB
Seedhack MongoDB 2011
TechEd AU 2014: Microsoft Azure DocumentDB Deep Dive
A Presentation on MongoDB Introduction - Habilelabs
Scaling MongoDB

Recently uploaded (20)

PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
Major-Components-ofNKJNNKNKNKNKronment.pptx
PDF
Introduction to Business Data Analytics.
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
Database Infoormation System (DBIS).pptx
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
Introduction to Knowledge Engineering Part 1
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PDF
Lecture1 pattern recognition............
PPTX
Supervised vs unsupervised machine learning algorithms
PPTX
Computer network topology notes for revision
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPT
Quality review (1)_presentation of this 21
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
Major-Components-ofNKJNNKNKNKNKronment.pptx
Introduction to Business Data Analytics.
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
oil_refinery_comprehensive_20250804084928 (1).pptx
Reliability_Chapter_ presentation 1221.5784
Database Infoormation System (DBIS).pptx
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
climate analysis of Dhaka ,Banglades.pptx
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Introduction to Knowledge Engineering Part 1
.pdf is not working space design for the following data for the following dat...
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Lecture1 pattern recognition............
Supervised vs unsupervised machine learning algorithms
Computer network topology notes for revision
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Quality review (1)_presentation of this 21

Schema Agnostic Indexing with Azure DocumentDB

  • 1. Schema Agnostic Indexing with Azure DocumentDB @dharmashukla, DocumentDB Presented at VLDB 2015 Sudipta Sengupta, Justin Levandoski, David Lomet Microsoft Research Dharma Shukla, Shireesh Thota, Karthik Raman, Madhan Gajendran, Ankur Shah, Sergii Ziuzin, Krishnan Sundaram, Miguel Gonzalez Guajardo, Anna Wawrzyniak, Samer Boshra, Renato Ferreira, Mohamed Nassar, Michael Koltachev, Ji Huang Microsoft Corporation
  • 2.  Overview of DocumentDB  Schema Agnostic Indexing  Logical Index Organization  Physical Index Organization  Summary Outline
  • 3.  Fully managed, multi-tenant, geo-distributed document database service on Azure  Born out of the needs of internal Microsoft applications; GA since April 2015  Built from the ground up with resource governance  Provisioned throughput, performance isolation, OPEX efficiency  Well defined consistency levels with predictable performance  Database engine built for JSON & JavaScript  Automatic indexing of JSON values and rich (SQL and JavaScript) query  JavaScript language integrated transactions and query directly inside the database engine What is DocumentDB? Strong Bounded Staleness Session Eventual
  • 5. JavaScript Object Literals JSON serializable values (aka JSON Infoset) { "locations": [ { "country": "Germany", "city": "Berlin" }, { "country": "France", "city": "Paris" } ], "headquarter": "Belgium", "exports":[{ "city": "Moscow" },{ "city": "Athens"}] } locations headquarter exports 0 1 country Germany city Berlin country France city Paris city Moscow city Athens Belgium 0 1 • Automatic indexing of document trees without requiring schema or secondary indices • SQL and JavaScript query processing on the trees • Lazy materialization of JavaScript values from the instances of trees JSON document as tree Schema-agnostic indexing
  • 6. • Index is a union of all the document trees Common structure • Structural information and instance values are normalized into a unifying concept of JSON-Path Terms Postings List/Values $/location/0/ 1, 2 location/0/country/ 1, 2 location/0/city/ 1, 2 0/country/Germany 1, 2 1/country/France 2 … … 0/city/Moscow 2 0/dealers/0 2 0 Germany location 0 location country 0 country Range (>, <, !=) & ORDERBY queries 0 Germany location 0 location country 0 country Wildcard queries Spatial queries 0 coordinates Dynamic Encoding of Postings List (E-WAH/differential) Logical Index Organization
  • 7. Query { "results": [ { "locations": [ {"country":"Germany","city":"Berlin"}, {"country":"France","city":"Paris"} ] } ] } { "locations": [ { "country": "Germany", "city": "Berlin" }, { "country": "France", "city": "Paris" } ], "headquarter": "Belgium", "exports": [{ "city": "Moscow" }, { "city": "Athens" }] } { "locations": [{ "country": "Germany", "city": "Bonn", "revenue": 200 } ], "headquarter": "Italy", "exports": [ { "city": "Berlin","dealers": [{"name": "Hans"}] }, { "city": "Athens" } ] } locations headquarter exports 0 1 country Germany city Berlin country France city Paris city Moscow city Athens Belgium locations headquarter 0 country Germany city Bonn revenue 200 Italy 0 1 exports city Berlin city Athens 0 1 dealers 0 Hans name 0 locations 0 1 country Germany city Berlin country France city Paris SELECT C.locations FROM company C WHERE C.headquarter = "Belgium" results Query result Input documents function businessLogic() { var country = "Belgium"; __.filter(function(x){return x.headquarter===country;});} SQL JavaScript
  • 8. doc_id =5 key: “age/22” payload: +doc5 key: “age/21” payload: -doc5 key: “city/seattle” payload: +doc5 key: “zip/98103” payload: +doc5 … Path/Posting List updates Index Query Processor Indexscan > “age/30” < “age/32” doc1, doc5, doc7 System model for writes and queries
  • 9. B-Tree Cache Log Structured Store Index Maintanance Requirements • Support sustained volume of rapid writes without any term locality • Queries should honor various consistency levels • Index maintenance must operate within frugal resource budget • Low write, read and space amplification
  • 10. Page P Page ID Physical Address P Mapping Table Δ: Insert record 50 Δ: Delete record 48 Δ: Update record 35 Δ: Insert record 60 Consolidated Page P Update record 35 Insert record 60 HighlyConcurrentPageUpdatesHighly concurrent index updates
  • 11. Base page Log-structured Store on SSD . . . . . Mapping table Writeorderinginlog Base page Base page -record -record (Latch-free) Flush Buffer (8MB) . . Base page -record -record RAM -record WriteOptimizedStorageOrganizationWrite optimized storage organization
  • 12. • Little to no term locality on index write path • Unable to keep “hot set” of leaf pages cached in memory • Performing read to modify each leaf node leads to very high I/O overhead • Requires method to maintain efficient write path for sustained term ingestion with predictable performance update term t1 delete term t58 insert term t109 update term t179 update term t568 delete term t732 Lack of term locality
  • 13. Blindupdates&ValueMerge Address Mapping Table Log Structured Store (LSS) T  {doc1, doc2, doc3, doc5} Term T  -doc2 P Read I/O Page Stub Address Mapping Table Log Structured Store (LSS) Term T  +doc5 P T->+doc2 T->-doc2 Page Stub {doc1, doc2, doc3} {+doc5} {-doc2} Term lookup or full page consolidate Page P T  {doc1, doc2, doc3} Add doc5 to posting list for term T Page P T  {doc1, doc2, doc3} Page P T  {doc1, doc2, doc3} … Consolidated Page P T  {doc1, doc3, doc5} Blind update for term T Blind updates and value merge 0 2000 4000 6000 8000 10000 12000 14000 16000 18000 0 2000 4000 6000 8000 10000 NumberofIOs Index Size (MB) Update Blind Update