05 / 15

What are advantages of Sharding?

Sharding in MongoDB is a technique used to horizontally scale a database by distributing data across multiple servers or clusters, known as shards.

Below are the advantages of sharding:
  1. 1

    Sharding allows you to scale your database horizontally, meaning you can add more servers (shards) to the cluster to handle increased load, rather than upgrading existing hardware.

  2. 2

    Since data is distributed, each shard is responsible for only a portion of the data, reducing the workload on individual servers.

  3. 3

    Queries and writes can be executed in parallel across shards, leading to faster query execution and better response times.

  4. 4

    Shards can be deployed on separate hardware, making it cost-effective to utilize commodity servers instead of scaling vertically with expensive high-end hardware.

  5. 5

    Sharding enables geographical partitioning, allowing data to be stored on shards located close to users. This reduces latency and improves the overall user experience.

  6. 6

    You can start with a small number of shards and gradually add more as your data grows. This makes it a flexible solution for scaling as your application evolves.

  7. 7

    Thus overall sharding imporves performance, efficiency, scalability and cost effectiveness.

javascript