It is a technique used to scale a database by horizontally partitioning the data across multiple servers, or shards. The goal of sharding is to distribute the data and workload across multiple servers, so that each server can handle a smaller portion of the overall data and workload. This can help improve the performance and scalability of the database, as each server can process queries and updates more efficiently when it is working with a smaller amount of data.
๐ช๐ต๐ฎ๐ ๐ฎ๐ฟ๐ฒ ๐๐ต๐ฒ ๐บ๐ผ๐๐ ๐ฐ๐ผ๐บ๐บ๐ผ๐ป ๐บ๐ฒ๐๐ต๐ผ๐ฑ๐ ๐ณ๐ผ๐ฟ ๐ถ๐บ๐ฝ๐น๐ฒ๐บ๐ฒ๐ป๐๐ถ๐ป๐ด ๐ฑ๐ฎ๐๐ฎ๐ฏ๐ฎ๐๐ฒ ๐๐ต๐ฎ๐ฟ๐ฑ๐ถ๐ป๐ด?
๐ฅ๐ฎ๐ป๐ด๐ฒ-๐ฏ๐ฎ๐๐ฒ๐ฑ ๐๐ต๐ฎ๐ฟ๐ฑ๐ถ๐ป๐ด: In this approach, the data is partitioned based on a key value, such as a user ID or a timestamp, and the data is distributed across the shards based on the range of the key value. For example, all user IDs in the range of 1-1000 might be stored on one shard, while user IDs in the range of 1001-2000 might be stored on another shard.
๐๐ฎ๐๐ต-๐ฏ๐ฎ๐๐ฒ๐ฑ ๐๐ต๐ฎ๐ฟ๐ฑ๐ถ๐ป๐ด: In this approach, a hash function is used to distribute the data across the shards based on the key value. For example, all data with a user ID of 123 might be stored on one shard, while data with a user ID of 456 might be stored on another shard.
๐๐ถ๐ฟ๐ฒ๐ฐ๐๐ผ๐ฟ๐-๐ฏ๐ฎ๐๐ฒ๐ฑ ๐๐ต๐ฎ๐ฟ๐ฑ๐ถ๐ป๐ด In this approach, a central directory is used to map the key values to the specific shard where the data is stored. The directory can be used to determine which shard a piece of data belongs to, and the data can be retrieved from the appropriate shard.
๐๐๐๐๐ผ๐บ ๐๐ต๐ฎ๐ฟ๐ฑ๐ถ๐ป๐ด: In some cases, it may be necessary to implement a custom sharding strategy that is specific to the needs and requirements of the database and the applications that are using it. This can involve a combination of different sharding methods, or a completely unique approach.
Ref:
โ
๐๐ฟ๐ผ๐ธ๐ธ๐ถ๐ป๐ด ๐๐ต๐ฒ ๐ฆ๐๐๐๐ฒ๐บ ๐๐ฒ๐๐ถ๐ด๐ป ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐: https://lnkd.in/g4Wii9r7
โ
๐๐ฟ๐ผ๐ธ๐ธ๐ถ๐ป๐ด ๐๐ต๐ฒ ๐๐ฑ๐๐ฎ๐ป๐ฐ๐ฒ๐ฑ ๐ฆ๐๐๐๐ฒ๐บ ๐๐ฒ๐๐ถ๐ด๐ป ๐๐ป๐๐ฒ๐ฟ๐๐ถ๐ฒ๐:ย https://lnkd.in/dyCRtiec