we are going to talk about Database Sharding Pattern. So we will add Database Sharding Pattern into our toolbox that we can use when scaling our microservices architecture.
Let me start with what is sharding ?
Sharding is “a small piece or part”, meaning to be a small piece or part of something. From this point of view, database sharding is the separation of the data into unique small pieces of database. So this small pieces is called shards or chunks.
So in order to improve scalability when storing and accessing large volumes of data in microservices architectures, we should divide a databases into a set of horizontal partitions or shards. Each shard has the same schema, but holds its own distinct subset of the data.