Life of a Sharded Write by Randolph Tan.

Slides:



Advertisements
Similar presentations
1 Data Concurrency David Konopnicki 1997 Revised by Mordo Shalom 2004.
Advertisements

Trishul Chilimbi, Yutaka Suzue, Johnson Apacible,
Distributed Systems 2006 Styles of Client/Server Computing.
OSD Metadata Management
Distributed Systems Fall 2009 Replication Fall 20095DV0203 Outline Group communication Fault-tolerant services –Passive and active replication Highly.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
More on Replication and Consistency CS-4513 D-term More on Replication and Consistency CS-4513 Distributed Computing Systems (Slides include materials.
Graph databases …the other end of the NoSQL spectrum. Material taken from NoSQL Distilled and Seven Databases in Seven Weeks.
Installing and Setting up mongoDB replica set PREPARED BY SUDHEER KONDLA SOLUTIONS ARCHITECT.
MongoDB Sharding and its Threats
Worldwide Partner Group WPG grow my business I am here to MSPP Quarterly Competency Requirements Update Changes for May 2009.
Software Engineer, #MongoDBDays.
Distributed Systems Tutorial 11 – Yahoo! PNUTS written by Alex Libov Based on OSCON 2011 presentation winter semester,
Managing Multi-User Databases AIMS 3710 R. Nakatsu.
Introduction To OpenLDAP Directory Services. What is a Directory Service? A specialized database optimized for reading, browsing, and searching. No complicated.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
Genuitec’s S ecure D elivery C enter 2012 Overview of delivering MyEclipse, Eclipse and IBM Rational technologies inside the firewall… Genuitec's Secure.
MongoDB Replica,Shard Cluster 中央大學電算中心 楊素秋
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
Client-Server Processing, Parallel Database Processing and Distributed Database Systems. KEVIN ROBERTS ANIKET MURLIDHARAN.
Unit 9 Transaction Processing. Key Concepts Distributed databases and DDBMS Distributed database advantages. Distributed database disadvantages Using.
Microsoft Dynamics NAV 2009 Building Web Services.
Introduction to DFS. Distributed File Systems A file system whose clients, servers and storage devices are dispersed among the machines of a distributed.
MapReduce and GFS. Introduction r To understand Google’s file system let us look at the sort of processing that needs to be done r We will look at MapReduce.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation MongoDB Architecture.
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
GFS. Google r Servers are a mix of commodity machines and machines specifically designed for Google m Not necessarily the fastest m Purchases are based.
Distributed Systems CS Consistency and Replication – Part IV Lecture 21, Nov 10, 2014 Mohammad Hammoud.
NFSv4 Namespace & Migration Charles Fan Rainfinity.
1 Multiversion Reconciliation for Mobile Databases Shirish Hemanath Phatak & B.R.Badrinath Presented By Presented By Md. Abdur Rahman Md. Abdur Rahman.
Caching Consistency and Concurrency Control Contact: Dingshan He
ArcGIS Editor for OpenStreetMap: Contributing Data Christine White.
Department of Computing, School of Electrical Engineering and Computer Sciences, NUST - Islamabad KTH Applied Information Security Lab Secure Sharding.
MongoDB First Light. Mongo DB Basics Mongo is a document based NoSQL. –A document is just a JSON object. –A collection is just a (large) set of documents.
Senior Solutions Architect, MongoDB Inc. Massimo Brignoli #MongoDB Introduction to Sharding.
Momentum. Strategy & Roadmapping Business Analysis Information Architecture Usability / User Experience Rich Media Social Media (Web 2.0) Interface Design.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 24: GFS.
Clustering in OpenDaylight
Distributed Databases – Advanced Concepts Chapter 25 in Textbook.
Plan for Final Lecture What you may expect to be asked in the Exam?
Build /26/2018 6:17 AM Building Resilient, Scalable Services with Microsoft Azure Service Fabric Érsek © 2015 Microsoft Corporation.
Managing Multi-User Databases
Database Services Katarzyna Dziedziniewicz-Wojcik On behalf of IT-DB.
Human resource & Payroll news you can use
MongoDB Distributed Write and Read
Learning MongoDB ZhangGang
Cassandra Transaction Processing
SysML 2.0 Model Lifecycle Management (MLM) Working Group
# - it’s not about social media it’s about temporary tables and data
# - it’s not about social media it’s about temporary tables and data
MongoDB Connection in Husky
Google File System CSE 454 From paper by Ghemawat, Gobioff & Leung.
Hybrid Apps: Azure Mobile Engagement and the App Economy
Purpose, Pitfalls and Performance Implications
EECS 498 Introduction to Distributed Systems Fall 2017
Arrested by the CAP Handling Data in Distributed Systems
Transaction Properties
Purpose, Pitfalls and Performance Implications
EECS 498 Introduction to Distributed Systems Fall 2017
Chapter 10 Transaction Management and Concurrency Control
Excel Rest API Sudhi Ramamurthy Program Manager, Office Extensibility
Consistency and Replication
Distributed Systems CS
Dynamics GP 2018 – Payroll and Human Resources
Windows Phone: Developer Best Practices and How to Maximize Performance
Decoupled Storage: “Free the Replicas!”
THE GOOGLE FILE SYSTEM.
Introduction of Week 14 Return assignment 12-1
Dennis Kafura – CS5204 – Operating Systems
Microsoft Virtual Academy
Presentation transcript:

Life of a Sharded Write by Randolph Tan

Sharding Concepts

Sharding concepts Shard0 Shard1 Shard2

Sharding concepts [minKey, -200) Shard0 Shard1 Shard2

Sharding concepts [minKey, -200) [-200, -100) Shard0 Shard1 Shard2

Sharding concepts Shard0 Shard1 Shard2 [minKey, -200) [-200, -100) [-100, 0) Shard0 Shard1 Shard2

Sharding concepts Shard0 Shard1 Shard2 [minKey, -200) [-200, -100) [0, 100) [-200, -100) [-100, 0) Shard0 Shard1 Shard2

Sharding concepts Shard0 Shard1 Shard2 [100, 200) [minKey, -200) [0, 100) [100, 200) [-200, -100) [-100, 0) Shard0 Shard1 Shard2

Sharding concepts Shard0 Shard1 Shard2 [100, 200) [minKey, -200) [0, 100) [200, maxKey) [100, 200) [-200, -100) [-100, 0) Shard0 Shard1 Shard2

Routing table min max owner MinKey -200 shard0 -100 shard2 100 200 100 200 shard1 MaxKey

Sharded Cluster Architecture shards mongos/ router sh0 Client App sh2 sh1 config servers

Sharded Single Doc Write db.foo.insert({ x: 1 }); sh0 shard0 mongos sh1 shard1 config servers

Sharded Single Doc Write Get routing table mongos sh1 shard1 config servers

Routing table db.foo.insert({ x: 1 }); min max owner MinKey -200 shard0 -100 shard2 100 200 shard1 MaxKey

Sharded Single Doc Write insert({ x: 1 }); shard0 mongos sh1 shard1 config servers

Chunk Migration Shard0 Shard1 Shard2 [100, 200) [minKey, -200) [0, 100) [200, maxKey) [100, 200) [-200, -100) [-100, 0) Shard0 Shard1 Shard2

Chunk Migration Shard0 Shard1 Shard2 [100, 200) [minKey, -200) [0, 100) [200, maxKey) [100, 200) [0, 100) [-200, -100) [-100, 0) Shard0 Shard1 Shard2

Sharding Version Protocol min max owner 1 MinKey -200 shard0 2 -100 shard2 3 4 100 5 200 shard1 6 MaxKey

Sharding Version Protocol nextVersion = max(routingTableVersions) + 1

Chunk Migration Shard0 Shard1 Shard2 [100, 200) [minKey, -200) [0, 100) [200, maxKey) [100, 200) [0, 100) [-200, -100) [-100, 0) Shard0 Shard1 Shard2

Sharding Version Protocol min max owner 1 MinKey -200 shard0 2 -100 shard2 3 4 -> 7 100 shard0 -> shard1 5 200 shard1 6 MaxKey

Sharded Single Doc Write db.foo.insert({ x: 1 }); shard0 w/ routing table v7 sh0 mongos shard1 w/ routing table v7 sh1 w/ routing table v6 config servers w/ routing table v7

Sharding Version Protocol min max owner 1 MinKey -200 shard0 2 -100 shard2 3 4 100 5 200 shard1 6 MaxKey

Sharded Single Doc Write w/ routing table v7 insert({ x: 1 }); @ v6 sh0 mongos shard1 w/ routing table v7 sh1 w/ routing table v6 config servers w/ routing table v7

Sharded Single Doc Write v6 != v7 shard0 w/ routing table v7 sh0 mongos shard1 w/ routing table v7 sh1 w/ routing table v6 config servers w/ routing table v7

Sharded Single Doc Write w/ routing table v7 sh0 update routing table mongos shard1 w/ routing table v7 sh1 w/ routing table v6 config servers w/ routing table v7

Sharding Version Protocol min max owner 1 MinKey -200 shard0 2 -100 shard2 3 7 100 shard1 5 200 6 MaxKey

Sharded Single Doc Write w/ routing table v7 sh0 insert({ x: 1 }); @v7 mongos shard1 w/ routing table v7 sh1 w/ routing table v7 config servers w/ routing table v7

Mirrored Config Servers mongos

Mirrored Config Servers update x mongos

Mirrored Config Servers 1 update x mongos

Mirrored Config Servers update x mongos 2

Mirrored Config Servers update x mongos 3

Mirrored Config Servers update x mongos

Mirrored Config Servers mongos

Mirrored Config Servers mongos

CSRS (Config Server as Replica Sets) Config servers mongos

Mirrored Config vs CSRS Recap Lost write inconsistency

Mirrored Config vs CSRS Recap Lost write inconsistency Single source of truth

Mirrored Config vs CSRS Recap Lost write inconsistency Single source of truth Read only when special server dies

Mirrored Config vs CSRS Recap Lost write inconsistency Single source of truth Read only when special server dies New primary gets elected

Mirrored Config vs CSRS Recap Lost write inconsistency Single source of truth Read only when special server dies New primary gets elected Complicated distributed lock

Mirrored Config vs CSRS Recap Lost write inconsistency Single source of truth Read only when special server dies New primary gets elected Complicated distributed lock Single server maintains lock

CSRS Challenges Possible to read data that may roll back Data on secondaries may be too stale

Rollback Example rTable v6 [0, 100) -> sh0 [-100, 0) -> sh2 P

Rollback Example rTable v7 [0, 100) -> sh0 [-100, 0) -> sh2 sh1

Rollback Example rTable v7 [0, 100) -> sh0 [-100, 0) -> sh1 P

Rollback Example rTable v7 [0, 100) -> sh0 [-100, 0) -> sh1

Rollback Example rTable v7 [0, 100) -> sh0 [-100, 0) -> sh1

Rollback Example rTable v7 [0, 100) -> sh0 [-100, 0) -> sh1

Rollback Example rTable v7 [0, 100) -> sh0 [-100, 0) -> sh1 R

Rollback Example rTable v6 [0, 100) -> sh0 [-100, 0) -> sh1 sh2

Rollback Example rTable v6 [0, 100) -> sh0 [-100, 0) -> sh2 S

Rollback Example rTable v7 [0, 100) -> sh1 [-100, 0) -> sh2 S

Rollback Example rTable v7 [0, 100) -> sh0 [-100, 0) -> sh1

New Feature db.runCommand({ find: ‘foo’, filter: { x: 1 }, readConcern: { level: ‘majority’ } });

Rollback Example Commited view rTable v6 [0, 100) -> sh0

CSRS Challenges Possible to read data that may roll back readConcern majority Data on secondaries may be too stale

Stale Reads Example v6 != v7 sh0 rTable v7 mongos rTable v6 sh1 Resume practice here rTable v6

Stale Reads Example sh0 rTable v7 mongos rTable v6 sh1 update routing Already up to date??? rTable v7 rTable v6

New Feature (internal use only) db.runCommand({ find: ‘foo’, filter: { x: 1 }, readConcern: { level: ‘majority’, afterOpTime: <opTime> }});

Read after OpTime Example rTable v6, opTime t9 sh0 rTable v7 mongos rTable v6 sh1 rTable v7 rTable v7 rTable v6

Read after OpTime Example rTable v7, opTime t11 sh0 rTable v7 mongos rTable v6 sh1 rTable v7 rTable v7 rTable v6

Read after OpTime Example sh0 rTable v7 mongos sh1 rTable v7 Wait until t >= t11; update routing table rTable v7 rTable v6

Read after OpTime Example sh0 rTable v7 mongos sh1 rTable v7 Wait until t >= t11; update routing table rTable v7 rTable v7

Sharding Version Protocol min max owner 1 MinKey -200 shard0 2 -100 shard2 3 7 100 shard1 5 200 6 MaxKey

Read after OpTime Example sh0 rTable v7 insert({ x: 1 }); mongos sh1 rTable v7 rTable v7 rTable v7

CSRS Challenges Possible to read data that may roll back readConcern majority Data on secondaries may be too stale readConcern afterOpTime

New in v3.2 Config servers can be replica sets (required in v3.4) New feature: readConcern

Future Possibilities afterOpTime functionality outside of internal code

Further reading https://docs.mongodb.com read concern replica set rollback sharding concepts

Questions?

International Offices Market Size $36 Billion International Offices 15 Partners 1,000+ Global Employees 575+ Downloads Worldwide 15,000,000+     Make a GIANT Impact www.mongodb.com/careers