MongoDB: Sharding

  1. What is sharding?
  2. How is it done?
  3. Pitfalls & how to design your data distribution strategy?
  4. When it should be done?
  5. When is it too late?

Horizontal scaling (scaling-out)

Horizontal partitioning

  1. Shard-key is immutable
  2. Shard-key once defined cannot be changed
  3. A sharded collection cannot be un-sharded
  • An application that requires segmenting user data based on the geographic country — For example, certain business is governed by data-protection rules.
  • A database that requires resource allocation based on geographic country.
  1. Data protection rules can be satisfied
  2. Data is collocated within the fixed set of shards within the zone
  3. Read-scalability — Such cases, the queries are also zone-specific, so fewer shards have to work for a given query.
  1. Scaling can be limited to the zone. Even if servers in one zone are over-loaded they cannot leverage the idle capacity in the other zone.

When should you go for sharding?

When is it too late to scale-out?

  1. When the working set is already to the brim
  2. When the CPU is already working above the threshold
  3. When the storage limitations thresholds have crossed.

Conclusion

--

--

--

Java Architect | MongoDB | Oracle DB| Application Performance Tuning | Design Thinking | https://www.linkedin.com/in/saradasastri/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Why ITCube Is the Most Preferred MS Dynamics 365 Development Solution Provider

TryHackMe: [Day 3] Web Exploitation Christmas Blackout

How To Cheat WaniKani

Bash Alias: cd into newest directory

Testnet Guide —EvmoSwap

Ecto Changeset for verifying parameters used in your API

Deflect Launches on Layer 2 (MATIC) as mDEF

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sarada Sastri

Sarada Sastri

Java Architect | MongoDB | Oracle DB| Application Performance Tuning | Design Thinking | https://www.linkedin.com/in/saradasastri/

More from Medium

What is RPC and how it is different from REST?

Kafka, Zookeeper e Docker 2

Spring: setting up a local development environment for micro services with Docker

CS373 Spring: Dillon Samra