SlideShare uma empresa Scribd logo
1 de 17
Baixar para ler offline
MongoDB	
  Sharding	
  
fundamentals	
  
Antonios	
  Giannopoulos	
  	
  
Database	
  Administrator	
  at	
  
ObjectRocket	
  by	
  Rackspace	
  
Background	
  
-­‐  14	
  years	
  in	
  databases	
  and	
  system	
  engineering	
  
-­‐  NoSQL	
  DBA	
  @	
  ObjectRocket	
  by	
  Rackspace	
  
	
  
-­‐  MongoDB	
  CerFfied	
  DBA	
  
What	
  is	
  sharding?	
  
-­‐  A	
  mechanism	
  for	
  horizontal	
  scaling	
  
	
  
-­‐  Distributes	
  the	
  dataset	
  over	
  mulFple	
  servers	
  
(shards)	
  
	
  
-­‐  Each	
  shard	
  is	
  an	
  independent	
  database	
  
	
  
-­‐  All	
  shards	
  consists	
  a	
  single	
  logical	
  database	
  
Why	
  Sharding?	
  
-­‐  Increases	
  cluster	
  throughput	
  –	
  Read/Write	
  
Scaling	
  
	
  
-­‐  Reduces	
  costs	
  -­‐	
  Many	
  small	
  servers	
  VS	
  one	
  big	
  
box	
  
-­‐  Eliminates	
  HW	
  and	
  SW	
  hard	
  limits	
  
MongoDB	
  Sharding	
  
-­‐  Consists	
  of	
  three	
  elements:	
  Shards,	
  Config	
  Servers	
  and	
  
Mongos	
  
	
  
-­‐  Shards:	
  Hold	
  the	
  cluster	
  data,	
  databases,	
  collecFons,	
  
documents	
  (Data	
  nodes)	
  
-­‐  Config	
  Servers:	
  Hold	
  the	
  cluster	
  metadata,	
  map	
  the	
  cluster	
  
architecture.	
  
-­‐  	
  Mongos:	
  Serve	
  all	
  drivers	
  requests.	
  Route	
  each	
  request	
  to	
  a	
  
shard	
  or	
  shards	
  (Router	
  nodes)	
  
ApplicaFon	
  /	
  Driver	
  Layer	
  	
  
Mongos01	
   Mongos02	
   MongosN	
  
ConfigSrv01	
  
ConfigSrv02	
  
ConfigSrv03	
  
Shard02	
   ShardN	
  
MongoDB	
  Sharded	
  Cluster	
  
Shard01	
   …	
  
…	
  
How	
  Sharding	
  works?	
  
-­‐  Range	
  parFFoning	
  per	
  collecFon	
  (chunks)	
  
-­‐  Shard	
  key	
  to	
  define	
  chunks	
  (field(s))	
  
-­‐  Chunks	
  are	
  “metadata”	
  on	
  the	
  config	
  servers	
  
-­‐  Chunks	
  can	
  move,	
  split	
  and	
  merge	
  
How	
  Sharding	
  works?	
  -­‐	
  Example	
  
{	
  "name"	
  :	
  "Angelina",	
  "surname"	
  :	
  "Jolie",	
  "posiFon"	
  :	
  "Windows	
  Eng.",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Emma",	
  "surname"	
  :	
  "Stone",	
  "posiFon"	
  :	
  "Windows	
  Eng.",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Charlize",	
  "surname"	
  :	
  "Theron",	
  "posiFon"	
  :	
  "Linux	
  Eng.",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Olivia",	
  "surname"	
  :	
  "Wilde",	
  "posiFon"	
  :	
  "Linux	
  Eng.",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Jessica",	
  "surname"	
  :	
  "Alba",	
  "posiFon"	
  :	
  "Sr	
  Linux	
  Eng.",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Scarlef",	
  "surname"	
  :	
  "Johansson",	
  "posiFon"	
  :	
  "Sr	
  Windows	
  Eng.",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Megan",	
  "surname"	
  :	
  "Fox",	
  "posiFon"	
  :	
  "Networks	
  Eng.",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Mila",	
  "surname"	
  :	
  "Kunis",	
  "posiFon"	
  :	
  "Sr	
  Networks	
  Eng.",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Natalie",	
  "surname"	
  :	
  "Portman",	
  "posiFon"	
  :	
  "Database	
  Eng",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
{	
  "name"	
  :	
  "Anne",	
  "surname"	
  :	
  "Hathaway",	
  "posiFon"	
  :	
  "Sr	
  Database	
  Eng",	
  "phone"	
  :	
  "555-­‐5555"	
  }	
  
	
  
	
  
-­‐  CollecFon	
  employees	
  for	
  an	
  IT	
  company	
  
-­‐  Shard	
  key	
  “posi-on”	
  
How	
  Sharding	
  works?	
  -­‐	
  Example	
  
{	
  "min"	
  :	
  {	
  "posiFon"	
  :	
  {	
  "$minKey"	
  :	
  1	
  }	
  },	
  "max"	
  :	
  {	
  "posiFon"	
  :	
  "Database	
  Eng"	
  },	
  
"shard"	
  :	
  ”Shard01"	
  }	
  
	
  
{	
  "min"	
  :	
  {	
  "posiFon"	
  :	
  "Database	
  Eng"	
  },	
  "max"	
  :	
  {	
  "posiFon"	
  :	
  "Sr	
  Database	
  
Eng"	
  },	
  "shard"	
  :	
  "Shard01"	
  }	
  
	
  
{	
  "min"	
  :	
  {	
  "posiFon"	
  :	
  "Sr	
  Database	
  Eng"	
  },	
  "max"	
  :	
  {	
  "posiFon"	
  :	
  "Windows	
  
Eng."	
  },	
  "shard"	
  :	
  "Shard02"	
  }	
  
	
  
{	
  "min"	
  :	
  {	
  "posiFon"	
  :	
  "Windows	
  Eng."	
  },	
  "max"	
  :	
  {	
  "posiFon"	
  :	
  {	
  "$maxKey"	
  :	
  1	
  }	
  },	
  
"shard"	
  :	
  "Shard02"	
  }	
  
	
  
-­‐	
  Lower/upper	
  bound	
  and	
  shard	
  (server)	
  	
  	
  
	
  
Choose	
  a	
  shard	
  key	
  
-­‐  High	
  Cardinality	
  
-­‐  Not	
  Null	
  values	
  
-­‐  Immutable	
  field(s)	
  
	
  
-­‐  Not	
  Monotonically	
  increased	
  fields	
  
	
  
Choose	
  a	
  shard	
  key	
  
-­‐  Even	
  read/write	
  distribuFon	
  
-­‐  Even	
  data	
  distribuFon	
  
	
  
-­‐  Read	
  targeFng	
  
-­‐  Read	
  locality	
  
Choose	
  a	
  shard	
  key	
  
-­‐  Hashed	
  shard	
  keys	
  for	
  randomness	
  
	
  
-­‐  Compound	
  shard	
  keys	
  for	
  cardinality	
  
	
  
-­‐  Unique	
  indexes	
  are	
  good	
  	
  
-­‐  {_id:”hashed”}	
  scales	
  writes	
  
LimitaFons	
  of	
  Sharding	
  
-­‐  Unique	
  indexes	
  –	
  Just	
  one…	
  
-­‐  IniFal	
  collecFon	
  size	
  –	
  Avoid	
  collecFons	
  >	
  256G,	
  
hard	
  limit	
  is	
  a	
  funcFon	
  of	
  key	
  and	
  chunk	
  size	
  ,	
  
for	
  64MB	
  chunk/512B	
  key	
  is	
  more	
  than	
  1TB	
  
	
  
-­‐  Number	
  of	
  documents	
  per	
  chunk	
  	
  (250K)	
  	
  
LimitaFons	
  of	
  Sharding	
  
-­‐  Shard	
  key	
  size	
  <	
  512	
  bytes	
  
-­‐  MulFkey,text,	
  geo	
  indexes	
  are	
  prohibited	
  
-­‐  Some	
  operaFons	
  won’t	
  run	
  (for	
  example	
  group,	
  
db.eval(),	
  $isolated,	
  $snapshot,	
  geoSearch)	
  
“Sharding”	
  –	
  Other	
  players	
  
-­‐  ApplicaFon	
  level	
  sharding	
  
-­‐  Mysql	
  (MaxScale,	
  Fabric,…)	
  
	
  
-­‐  Postgres	
  (pg_shard)	
  
-­‐  ElasFcSearch	
  (Document	
  ID	
  or	
  rouFng)	
  
-­‐  Cassandra	
  (Hash-­‐based	
  -­‐	
  Ring	
  topology)	
  	
  
Contact	
  
www.objectrocket.com	
  
www.rackspace.co.uk/objectrocket/mongodb	
  
antonios.giannopoulos@rackspace.co.uk	
  
	
  
	
  
We	
  are	
  hiring!	
  (DevOps,	
  DBAs	
  and	
  more)	
  
hfp://objectrocket.com/careers	
  
QuesFons?	
  
	
  
Thank	
  you!!!	
  
	
  
MongoDB	
  Meetup	
  
What's	
  new	
  in	
  MongoDB	
  3.0	
  
	
  Tuesday,	
  November	
  10	
  ,	
  7:00	
  pm	
  
	
  @	
  Harokopio	
  University	
  
	
  

Mais conteúdo relacionado

Mais procurados (20)

Introduction to MongoDB.pptx
Introduction to MongoDB.pptxIntroduction to MongoDB.pptx
Introduction to MongoDB.pptx
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
Key-Value NoSQL Database
Key-Value NoSQL DatabaseKey-Value NoSQL Database
Key-Value NoSQL Database
 
MongoDB 101
MongoDB 101MongoDB 101
MongoDB 101
 
MongoDB presentation
MongoDB presentationMongoDB presentation
MongoDB presentation
 
6.hive
6.hive6.hive
6.hive
 
MongoDB at Scale
MongoDB at ScaleMongoDB at Scale
MongoDB at Scale
 
Apache Spark PDF
Apache Spark PDFApache Spark PDF
Apache Spark PDF
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
Mongo db intro.pptx
Mongo db intro.pptxMongo db intro.pptx
Mongo db intro.pptx
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB Internals
 
Nosql databases
Nosql databasesNosql databases
Nosql databases
 
MongoDB Schema Design
MongoDB Schema DesignMongoDB Schema Design
MongoDB Schema Design
 
PHP - Introduction to File Handling with PHP
PHP -  Introduction to  File Handling with PHPPHP -  Introduction to  File Handling with PHP
PHP - Introduction to File Handling with PHP
 

Destaque

Webinar: Choosing the Right Shard Key for High Performance and Scale
Webinar: Choosing the Right Shard Key for High Performance and ScaleWebinar: Choosing the Right Shard Key for High Performance and Scale
Webinar: Choosing the Right Shard Key for High Performance and ScaleMongoDB
 
Choosing a Shard key
Choosing a Shard keyChoosing a Shard key
Choosing a Shard keyMongoDB
 
MongoDB for Time Series Data: Sharding
MongoDB for Time Series Data: ShardingMongoDB for Time Series Data: Sharding
MongoDB for Time Series Data: ShardingMongoDB
 
MongoDB training for java software engineers
MongoDB training for java software engineersMongoDB training for java software engineers
MongoDB training for java software engineersMoshe Kaplan
 
Back to Basics Webinar 3: Introduction to Replica Sets
Back to Basics Webinar 3: Introduction to Replica SetsBack to Basics Webinar 3: Introduction to Replica Sets
Back to Basics Webinar 3: Introduction to Replica SetsMongoDB
 
Back to Basics 2017: Introduction to Sharding
Back to Basics 2017: Introduction to ShardingBack to Basics 2017: Introduction to Sharding
Back to Basics 2017: Introduction to ShardingMongoDB
 

Destaque (6)

Webinar: Choosing the Right Shard Key for High Performance and Scale
Webinar: Choosing the Right Shard Key for High Performance and ScaleWebinar: Choosing the Right Shard Key for High Performance and Scale
Webinar: Choosing the Right Shard Key for High Performance and Scale
 
Choosing a Shard key
Choosing a Shard keyChoosing a Shard key
Choosing a Shard key
 
MongoDB for Time Series Data: Sharding
MongoDB for Time Series Data: ShardingMongoDB for Time Series Data: Sharding
MongoDB for Time Series Data: Sharding
 
MongoDB training for java software engineers
MongoDB training for java software engineersMongoDB training for java software engineers
MongoDB training for java software engineers
 
Back to Basics Webinar 3: Introduction to Replica Sets
Back to Basics Webinar 3: Introduction to Replica SetsBack to Basics Webinar 3: Introduction to Replica Sets
Back to Basics Webinar 3: Introduction to Replica Sets
 
Back to Basics 2017: Introduction to Sharding
Back to Basics 2017: Introduction to ShardingBack to Basics 2017: Introduction to Sharding
Back to Basics 2017: Introduction to Sharding
 

Semelhante a MongoDB Sharding Fundamentals

2014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-22014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-2MongoDB
 
Spark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross LawleySpark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross LawleySpark Summit
 
How To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own DatasourceHow To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own DatasourceMongoDB
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersBen van Mol
 
20140614 introduction to spark-ben white
20140614 introduction to spark-ben white20140614 introduction to spark-ben white
20140614 introduction to spark-ben whiteData Con LA
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDBRick Copeland
 
Introduction to MongoDB and Workshop
Introduction to MongoDB and WorkshopIntroduction to MongoDB and Workshop
Introduction to MongoDB and WorkshopAhmedabadJavaMeetup
 
Spark Cassandra Connector Dataframes
Spark Cassandra Connector DataframesSpark Cassandra Connector Dataframes
Spark Cassandra Connector DataframesRussell Spitzer
 
Sharding
ShardingSharding
ShardingMongoDB
 
Scaling PyData Up and Out
Scaling PyData Up and OutScaling PyData Up and Out
Scaling PyData Up and OutTravis Oliphant
 
DBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsDBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsSrinivas Mutyala
 
MongoDB for Time Series Data Part 3: Sharding
MongoDB for Time Series Data Part 3: ShardingMongoDB for Time Series Data Part 3: Sharding
MongoDB for Time Series Data Part 3: ShardingMongoDB
 
Dangling DNS records takeover at scale
Dangling DNS records takeover at scaleDangling DNS records takeover at scale
Dangling DNS records takeover at scaleChandrapal Badshah
 
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael HausenblasBerlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael HausenblasMapR Technologies
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra ExplainedEric Evans
 
Шардинг в MongoDB, Henrik Ingo (MongoDB)
Шардинг в MongoDB, Henrik Ingo (MongoDB)Шардинг в MongoDB, Henrik Ingo (MongoDB)
Шардинг в MongoDB, Henrik Ingo (MongoDB)Ontico
 
My Sql And Search At Craigslist
My Sql And Search At CraigslistMy Sql And Search At Craigslist
My Sql And Search At CraigslistMySQLConference
 
Managing Your Content with Elasticsearch
Managing Your Content with ElasticsearchManaging Your Content with Elasticsearch
Managing Your Content with ElasticsearchSamantha Quiñones
 

Semelhante a MongoDB Sharding Fundamentals (20)

2014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-22014 05-07-fr - add dev series - session 6 - deploying your application-2
2014 05-07-fr - add dev series - session 6 - deploying your application-2
 
Spark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross LawleySpark Summit EU talk by Ross Lawley
Spark Summit EU talk by Ross Lawley
 
How To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own DatasourceHow To Connect Spark To Your Own Datasource
How To Connect Spark To Your Own Datasource
 
ElasticSearch for .NET Developers
ElasticSearch for .NET DevelopersElasticSearch for .NET Developers
ElasticSearch for .NET Developers
 
20140614 introduction to spark-ben white
20140614 introduction to spark-ben white20140614 introduction to spark-ben white
20140614 introduction to spark-ben white
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
Introduction to MongoDB and Workshop
Introduction to MongoDB and WorkshopIntroduction to MongoDB and Workshop
Introduction to MongoDB and Workshop
 
Spark Cassandra Connector Dataframes
Spark Cassandra Connector DataframesSpark Cassandra Connector Dataframes
Spark Cassandra Connector Dataframes
 
Sharding
ShardingSharding
Sharding
 
Scaling PyData Up and Out
Scaling PyData Up and OutScaling PyData Up and Out
Scaling PyData Up and Out
 
DBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training PresentationsDBVersity MongoDB Online Training Presentations
DBVersity MongoDB Online Training Presentations
 
MongoDB for Time Series Data Part 3: Sharding
MongoDB for Time Series Data Part 3: ShardingMongoDB for Time Series Data Part 3: Sharding
MongoDB for Time Series Data Part 3: Sharding
 
Dangling DNS records takeover at scale
Dangling DNS records takeover at scaleDangling DNS records takeover at scale
Dangling DNS records takeover at scale
 
Eyeing the Onion
Eyeing the OnionEyeing the Onion
Eyeing the Onion
 
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael HausenblasBerlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
Berlin Buzz Words - Apache Drill by Ted Dunning & Michael Hausenblas
 
MongoDB 3.0
MongoDB 3.0 MongoDB 3.0
MongoDB 3.0
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra Explained
 
Шардинг в MongoDB, Henrik Ingo (MongoDB)
Шардинг в MongoDB, Henrik Ingo (MongoDB)Шардинг в MongoDB, Henrik Ingo (MongoDB)
Шардинг в MongoDB, Henrik Ingo (MongoDB)
 
My Sql And Search At Craigslist
My Sql And Search At CraigslistMy Sql And Search At Craigslist
My Sql And Search At Craigslist
 
Managing Your Content with Elasticsearch
Managing Your Content with ElasticsearchManaging Your Content with Elasticsearch
Managing Your Content with Elasticsearch
 

Mais de Antonios Giannopoulos

Comparing Geospatial Implementation in MongoDB, Postgres, and Elastic
Comparing Geospatial Implementation in MongoDB, Postgres, and ElasticComparing Geospatial Implementation in MongoDB, Postgres, and Elastic
Comparing Geospatial Implementation in MongoDB, Postgres, and ElasticAntonios Giannopoulos
 
Using MongoDB with Kafka - Use Cases and Best Practices
Using MongoDB with Kafka -  Use Cases and Best PracticesUsing MongoDB with Kafka -  Use Cases and Best Practices
Using MongoDB with Kafka - Use Cases and Best PracticesAntonios Giannopoulos
 
Sharding in MongoDB 4.2 #what_is_new
 Sharding in MongoDB 4.2 #what_is_new Sharding in MongoDB 4.2 #what_is_new
Sharding in MongoDB 4.2 #what_is_newAntonios Giannopoulos
 
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2Antonios Giannopoulos
 
Managing data and operation distribution in MongoDB
Managing data and operation distribution in MongoDBManaging data and operation distribution in MongoDB
Managing data and operation distribution in MongoDBAntonios Giannopoulos
 
Upgrading to MongoDB 4.0 from older versions
Upgrading to MongoDB 4.0 from older versionsUpgrading to MongoDB 4.0 from older versions
Upgrading to MongoDB 4.0 from older versionsAntonios Giannopoulos
 
How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018Antonios Giannopoulos
 
Elastic 101 tutorial - Percona Europe 2018
Elastic 101 tutorial - Percona Europe 2018 Elastic 101 tutorial - Percona Europe 2018
Elastic 101 tutorial - Percona Europe 2018 Antonios Giannopoulos
 
MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017Antonios Giannopoulos
 
Percona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialPercona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialAntonios Giannopoulos
 
How sitecore depends on mongo db for scalability and performance, and what it...
How sitecore depends on mongo db for scalability and performance, and what it...How sitecore depends on mongo db for scalability and performance, and what it...
How sitecore depends on mongo db for scalability and performance, and what it...Antonios Giannopoulos
 
Antonios Giannopoulos Percona 2016 WiredTiger Configuration Variables
Antonios Giannopoulos Percona 2016 WiredTiger Configuration VariablesAntonios Giannopoulos Percona 2016 WiredTiger Configuration Variables
Antonios Giannopoulos Percona 2016 WiredTiger Configuration VariablesAntonios Giannopoulos
 
Introduction to Polyglot Persistence
Introduction to Polyglot Persistence Introduction to Polyglot Persistence
Introduction to Polyglot Persistence Antonios Giannopoulos
 

Mais de Antonios Giannopoulos (15)

Comparing Geospatial Implementation in MongoDB, Postgres, and Elastic
Comparing Geospatial Implementation in MongoDB, Postgres, and ElasticComparing Geospatial Implementation in MongoDB, Postgres, and Elastic
Comparing Geospatial Implementation in MongoDB, Postgres, and Elastic
 
Using MongoDB with Kafka - Use Cases and Best Practices
Using MongoDB with Kafka -  Use Cases and Best PracticesUsing MongoDB with Kafka -  Use Cases and Best Practices
Using MongoDB with Kafka - Use Cases and Best Practices
 
Sharding in MongoDB 4.2 #what_is_new
 Sharding in MongoDB 4.2 #what_is_new Sharding in MongoDB 4.2 #what_is_new
Sharding in MongoDB 4.2 #what_is_new
 
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
New Indexing and Aggregation Pipeline Capabilities in MongoDB 4.2
 
Managing data and operation distribution in MongoDB
Managing data and operation distribution in MongoDBManaging data and operation distribution in MongoDB
Managing data and operation distribution in MongoDB
 
Upgrading to MongoDB 4.0 from older versions
Upgrading to MongoDB 4.0 from older versionsUpgrading to MongoDB 4.0 from older versions
Upgrading to MongoDB 4.0 from older versions
 
How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018How to upgrade to MongoDB 4.0 - Percona Europe 2018
How to upgrade to MongoDB 4.0 - Percona Europe 2018
 
Elastic 101 tutorial - Percona Europe 2018
Elastic 101 tutorial - Percona Europe 2018 Elastic 101 tutorial - Percona Europe 2018
Elastic 101 tutorial - Percona Europe 2018
 
Triggers in MongoDB
Triggers in MongoDBTriggers in MongoDB
Triggers in MongoDB
 
Sharded cluster tutorial
Sharded cluster tutorialSharded cluster tutorial
Sharded cluster tutorial
 
MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017MongoDB – Sharded cluster tutorial - Percona Europe 2017
MongoDB – Sharded cluster tutorial - Percona Europe 2017
 
Percona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialPercona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorial
 
How sitecore depends on mongo db for scalability and performance, and what it...
How sitecore depends on mongo db for scalability and performance, and what it...How sitecore depends on mongo db for scalability and performance, and what it...
How sitecore depends on mongo db for scalability and performance, and what it...
 
Antonios Giannopoulos Percona 2016 WiredTiger Configuration Variables
Antonios Giannopoulos Percona 2016 WiredTiger Configuration VariablesAntonios Giannopoulos Percona 2016 WiredTiger Configuration Variables
Antonios Giannopoulos Percona 2016 WiredTiger Configuration Variables
 
Introduction to Polyglot Persistence
Introduction to Polyglot Persistence Introduction to Polyglot Persistence
Introduction to Polyglot Persistence
 

Último

Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...only4webmaster01
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteedamy56318795
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...amitlee9823
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsJoseMangaJr1
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramMoniSankarHazra
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...amitlee9823
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNKTimothy Spann
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...amitlee9823
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...karishmasinghjnh
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 

Último (20)

Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Nandini Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
👉 Amritsar Call Girl 👉📞 6367187148 👉📞 Just📲 Call Ruhi Call Girl Phone No Amri...
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 

MongoDB Sharding Fundamentals

  • 1. MongoDB  Sharding   fundamentals   Antonios  Giannopoulos     Database  Administrator  at   ObjectRocket  by  Rackspace  
  • 2. Background   -­‐  14  years  in  databases  and  system  engineering   -­‐  NoSQL  DBA  @  ObjectRocket  by  Rackspace     -­‐  MongoDB  CerFfied  DBA  
  • 3. What  is  sharding?   -­‐  A  mechanism  for  horizontal  scaling     -­‐  Distributes  the  dataset  over  mulFple  servers   (shards)     -­‐  Each  shard  is  an  independent  database     -­‐  All  shards  consists  a  single  logical  database  
  • 4. Why  Sharding?   -­‐  Increases  cluster  throughput  –  Read/Write   Scaling     -­‐  Reduces  costs  -­‐  Many  small  servers  VS  one  big   box   -­‐  Eliminates  HW  and  SW  hard  limits  
  • 5. MongoDB  Sharding   -­‐  Consists  of  three  elements:  Shards,  Config  Servers  and   Mongos     -­‐  Shards:  Hold  the  cluster  data,  databases,  collecFons,   documents  (Data  nodes)   -­‐  Config  Servers:  Hold  the  cluster  metadata,  map  the  cluster   architecture.   -­‐   Mongos:  Serve  all  drivers  requests.  Route  each  request  to  a   shard  or  shards  (Router  nodes)  
  • 6. ApplicaFon  /  Driver  Layer     Mongos01   Mongos02   MongosN   ConfigSrv01   ConfigSrv02   ConfigSrv03   Shard02   ShardN   MongoDB  Sharded  Cluster   Shard01   …   …  
  • 7. How  Sharding  works?   -­‐  Range  parFFoning  per  collecFon  (chunks)   -­‐  Shard  key  to  define  chunks  (field(s))   -­‐  Chunks  are  “metadata”  on  the  config  servers   -­‐  Chunks  can  move,  split  and  merge  
  • 8. How  Sharding  works?  -­‐  Example   {  "name"  :  "Angelina",  "surname"  :  "Jolie",  "posiFon"  :  "Windows  Eng.",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Emma",  "surname"  :  "Stone",  "posiFon"  :  "Windows  Eng.",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Charlize",  "surname"  :  "Theron",  "posiFon"  :  "Linux  Eng.",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Olivia",  "surname"  :  "Wilde",  "posiFon"  :  "Linux  Eng.",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Jessica",  "surname"  :  "Alba",  "posiFon"  :  "Sr  Linux  Eng.",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Scarlef",  "surname"  :  "Johansson",  "posiFon"  :  "Sr  Windows  Eng.",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Megan",  "surname"  :  "Fox",  "posiFon"  :  "Networks  Eng.",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Mila",  "surname"  :  "Kunis",  "posiFon"  :  "Sr  Networks  Eng.",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Natalie",  "surname"  :  "Portman",  "posiFon"  :  "Database  Eng",  "phone"  :  "555-­‐5555"  }   {  "name"  :  "Anne",  "surname"  :  "Hathaway",  "posiFon"  :  "Sr  Database  Eng",  "phone"  :  "555-­‐5555"  }       -­‐  CollecFon  employees  for  an  IT  company   -­‐  Shard  key  “posi-on”  
  • 9. How  Sharding  works?  -­‐  Example   {  "min"  :  {  "posiFon"  :  {  "$minKey"  :  1  }  },  "max"  :  {  "posiFon"  :  "Database  Eng"  },   "shard"  :  ”Shard01"  }     {  "min"  :  {  "posiFon"  :  "Database  Eng"  },  "max"  :  {  "posiFon"  :  "Sr  Database   Eng"  },  "shard"  :  "Shard01"  }     {  "min"  :  {  "posiFon"  :  "Sr  Database  Eng"  },  "max"  :  {  "posiFon"  :  "Windows   Eng."  },  "shard"  :  "Shard02"  }     {  "min"  :  {  "posiFon"  :  "Windows  Eng."  },  "max"  :  {  "posiFon"  :  {  "$maxKey"  :  1  }  },   "shard"  :  "Shard02"  }     -­‐  Lower/upper  bound  and  shard  (server)        
  • 10. Choose  a  shard  key   -­‐  High  Cardinality   -­‐  Not  Null  values   -­‐  Immutable  field(s)     -­‐  Not  Monotonically  increased  fields    
  • 11. Choose  a  shard  key   -­‐  Even  read/write  distribuFon   -­‐  Even  data  distribuFon     -­‐  Read  targeFng   -­‐  Read  locality  
  • 12. Choose  a  shard  key   -­‐  Hashed  shard  keys  for  randomness     -­‐  Compound  shard  keys  for  cardinality     -­‐  Unique  indexes  are  good     -­‐  {_id:”hashed”}  scales  writes  
  • 13. LimitaFons  of  Sharding   -­‐  Unique  indexes  –  Just  one…   -­‐  IniFal  collecFon  size  –  Avoid  collecFons  >  256G,   hard  limit  is  a  funcFon  of  key  and  chunk  size  ,   for  64MB  chunk/512B  key  is  more  than  1TB     -­‐  Number  of  documents  per  chunk    (250K)    
  • 14. LimitaFons  of  Sharding   -­‐  Shard  key  size  <  512  bytes   -­‐  MulFkey,text,  geo  indexes  are  prohibited   -­‐  Some  operaFons  won’t  run  (for  example  group,   db.eval(),  $isolated,  $snapshot,  geoSearch)  
  • 15. “Sharding”  –  Other  players   -­‐  ApplicaFon  level  sharding   -­‐  Mysql  (MaxScale,  Fabric,…)     -­‐  Postgres  (pg_shard)   -­‐  ElasFcSearch  (Document  ID  or  rouFng)   -­‐  Cassandra  (Hash-­‐based  -­‐  Ring  topology)    
  • 16. Contact   www.objectrocket.com   www.rackspace.co.uk/objectrocket/mongodb   antonios.giannopoulos@rackspace.co.uk       We  are  hiring!  (DevOps,  DBAs  and  more)   hfp://objectrocket.com/careers  
  • 17. QuesFons?     Thank  you!!!     MongoDB  Meetup   What's  new  in  MongoDB  3.0    Tuesday,  November  10  ,  7:00  pm    @  Harokopio  University