S Harding
S Harding
S Harding
INTRODUCTION
•Sharding is the process of storing data records across multiple machines and it is
MongoDB's approach to meeting the demands of data growth.
•As the size of the data increases, a single machine may not be sufficient to store the
data nor provide an acceptable read and write throughput.
•Sharding solves the problem with horizontal scaling.
•With sharding, you add more machines to support data growth and the demands of
read and write operations.
WHY SHARDING?
•In replication, the primary node handles all write operations, whereas secondary
servers are required to maintain backup copies or serve read-only operations. But in
sharding along with replica sets, the load gets distributed among numbers of servers.
•A single replica set is limited to 12 nodes, but there is no restriction on the number
of shards.
•Replication requires high-end hardware or verticle scaling for handling large
datasets, which is too expensive compared to adding additional servers in sharding.
•In replication, read performance can be enhanced by adding more slave/secondary
servers, whereas, in sharding, both read and write performance will be enhanced by
adding more shards nodes.