Cómo MongoDB amplía el rendimiento de las operaciones de escritura y maneja grandes tamaño de datos
Cómo crear un sharded cluster básico
Cómo elegir una clave de sharding
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
Back to Basics Spanish 4 Introduction to sharding
1.
2. June 20-21, 2017
Chicago, IL
Chicago, IL
MongoDB World is where the
world’s fastest growing
database community comes
to connect, explore, and
learn.
5. Agenda del Curso
Date Time Webinar
25-Abril-2016 16:00 CEST Introducción a NoSQL
3-Mayo-2016 16:00 CEST Mi primera aplicación MongoDB
9-Mayo-2016 16:00 CEST Introducción a los ReplicaSets
16-Mayo-2016 16:00 CEST Introducción al Sharding
16:00 CEST = 14:00 UTC = 11:00am Argentina / Uruguay = 9:30am
Venezuela/Chile = 9:00am Colombia / Ecuador / México
6. Resumen de los webinars 1 a 3
• ¿Porqué existe NoSQL?
• Características clave de MongoDB
• Instalación y creación de bases de datos y colecciones
• Operaciones CRUD, Índices y explain()
• Replicación de datos en MongoDB
• MongoDB Atlas y Compass
7. Agenda de hoy
• ¿Qué es eso de Sharding? ¿Lo necesito?
• La arquitectura de un sharded cluster
• Restricciones en un sharded cluster
• ¿Cómo funciona en la práctica?
14. Construction
• Build Cluster
• Identify shard key
• Sharding happens on individual collections
• To shard a collection:
sh.shardCollection( "MUGS.members",{"name" : 1 } )
15. Sharding key
• Sharding key is the way MongoDB partition collections.
• The range of the sharding key is split in several chunks.
• The chunks are distributed evenly among the available shards
16. Selecting a sharding key
• Probably the most influential decision on performance
• A good sharding key has:
• High cardinality
• Evenly distributed frequency
• A non-monotonic creation rate
• And much more important: is used on queries.
• Limitations
• Sharding key is immutable
• Sharding key values are immutable
• Sharding key can’t be a multikey, geospatial or text index
17. Config servers and mongos
• Config servers store metadata (chunk distribution and location)
• They can be configured as a replica set from version 3.2 (CSRS)
• Up to 50 config servers
• Hardened failover
• mongos acts as query routers
• mongos keep a local copy of config server information
• mongos can be deployed on the application server
18. Sharding, when?
• Shard only when needed:
• Vertical scalability is not possible anymore
• RAM
• CPU
• IOPS
• Concurrency
• Depending on the server technology the range to start
thinking in sharding is around a few Tb of data.
30. Resumen
• Sharding = Horizontal Scalability
• MongoDB automatically balances the cluster
• Shards can be added dynamically to a live system
• Rebalancing happens in the background
• Shard key partitions the content
• Shard key is immutable
• Shard key can route queries to a specific shard
• Queries without a shard key are sent to all members
• Each member process its part in parallel.
31. What's Next?
• Sign up for an online course: https://university.mongodb.com/
• Join a MUG: https://www.meetup.com/pro/mongodb/
32. Próximo Webinar
¿¿Conceptos Avanzados??
• Nos quedan muchas cosas por compartir
• Índices Geográficos y de Texto Libre
• Seguridad
• Conectores de BI y Big Data
• Motores de Almacenamiento
• Y mucho más…
• Manténgase atento:
• Denos su opinión, por favor: back-to-basics@mongodb.com
Delighted to have you here. Hope you can make it to all the sessions. Sessions will be recorded so we can send them out afterwards so don’t worry if you miss one.
If you have questions please pop them in the sidebar.
Once chunk size is reached, mongos asks mongod to split a chunk
+ internal function called splitVector()
mongod counts number of documents on each side of split
+ based on avg. document size `db.stats()`
Chunk split is a **logical** operation (no data has moved)
Max on first chunk should be 14
Balancer is running on mongos
Once the difference in chunks between the most dense shard and the least dense shard is above the migration threshold, a balancing round starts