What is Database Sharding?

Database-Sharding-In-System-Design

Database sharding is a scalability technique that involves horizontally dividing the data across several servers or shards. This is because each server can function more effectively with fewer data points when processing requests and changes. Each server can manage a smaller portion of the total workload and data.

C๐—ผ๐—บ๐—บ๐—ผ๐—ป M๐—ฒ๐˜๐—ต๐—ผ๐—ฑ๐˜€ ๐—ณ๐—ผ๐—ฟ I๐—บ๐—ฝ๐—น๐—ฒ๐—บ๐—ฒ๐—ป๐˜๐—ถ๐—ป๐—ด D๐—ฎ๐˜๐—ฎ๐—ฏ๐—ฎ๐˜€๐—ฒ S๐—ต๐—ฎ๐—ฟ๐—ฑ๐—ถ๐—ป๐—ด?

  1. ๐—ฅ๐—ฎ๐—ป๐—ด๐—ฒ-๐—ฏ๐—ฎ๐˜€๐—ฒ๐—ฑ ๐˜€๐—ต๐—ฎ๐—ฟ๐—ฑ๐—ถ๐—ป๐—ด: This method partitions the data based on a key value, such as a user ID or a timestamp, and distributes the data among the shards according to the key value’s range. One shard, for instance, may include all user IDs in the range of 1 to 1000, while another shard would house all user IDs in the range of 1001 to 2000.
  2. ๐—›๐—ฎ๐˜€๐—ต-๐—ฏ๐—ฎ๐˜€๐—ฒ๐—ฑ ๐˜€๐—ต๐—ฎ๐—ฟ๐—ฑ๐—ถ๐—ป๐—ด: A hash function is employed in this strategy to distribute data among shards depending on the key value. For example, all data with the user ID 123 may be saved on one shard, while data with the user ID 456 could be stored on another.
  3. ๐——๐—ถ๐—ฟ๐—ฒ๐—ฐ๐˜๐—ผ๐—ฟ๐˜†-๐—ฏ๐—ฎ๐˜€๐—ฒ๐—ฑ ๐˜€๐—ต๐—ฎ๐—ฟ๐—ฑ๐—ถ๐—ป๐—ด: 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.
  4. ๐—–๐˜‚๐˜€๐˜๐—ผ๐—บ ๐˜€๐—ต๐—ฎ๐—ฟ๐—ฑ๐—ถ๐—ป๐—ด: When a database and the applications that use it have unique demands and requirements, it could be required to develop a bespoke sharding technique. This might comprise a mix of various sharding techniques or a whole original strategy.

Conclusion

Although database sharding may be a helpful strategy for enhancing a database’s efficiency and scalability, it is not always the best option for every use case and; should be carefully assessed based on a database system’s unique requirements.

Source:

  • ๐—š๐—ฟ๐—ผ๐—ธ๐—ธ๐—ถ๐—ป๐—ด ๐˜๐—ต๐—ฒ ๐—ฆ๐˜†๐˜€๐˜๐—ฒ๐—บ ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„: https://lnkd.in/g4Wii9r7
  • ๐—š๐—ฟ๐—ผ๐—ธ๐—ธ๐—ถ๐—ป๐—ด ๐˜๐—ต๐—ฒ ๐—”๐—ฑ๐˜ƒ๐—ฎ๐—ป๐—ฐ๐—ฒ๐—ฑ ๐—ฆ๐˜†๐˜€๐˜๐—ฒ๐—บ ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป ๐—œ๐—ป๐˜๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฒ๐˜„: https://lnkd.in/dyCRtiec

Leave a Comment

Your email address will not be published. Required fields are marked *