Hash-Range Partitioning | ben.kirw.in
In distributed systems, it’s extroardinarily common to want to split a large dataset across some number of physical shards or partitions. This is commonly done by taking the key, hashing it, and then taking the hash modulo the number of partitions: Let’s call that hash-modulus partitioning for short. It’s simple, straightforward, and correct, and it’s used as the default partitioner in projects from Spark to Kafka to Hive. It’s also far from optimal, especially when you’re joining different data sets together. Here’s a slightly different partitioning function, which I’ll call hash-range partitioning: This post explains how that function works and why you might prefer it. So we can visualize things easily, let’s imagine we’re using a tiny 4-bit hash function. This gives us 2^4=16 different possible hash values, mapping to the integers from 0 to 15. Hash-modulus partitioning will take those 16 values and round-robin them across our partitions. If we have 3 partitions for our 16 possible
Hash-Range Partitioning Better partitioning for distributed data In distributed systems, it’s extroardinarily common to want to split a large dataset across some number of physical shards or partitions. This is commonly done by taking the key, hashing it, and then taking the hash modulo the number of partitions: def partition(key, num_partitions): hash(key) % num_partitions Let’s call that hash-modulus partitioning for short. It’s simple, straightforward, and correct, and it’s used as the default partitioner in projects from Spark to Kafka to Hive. It’s also far from optimal, especially when y
Explore this link on the map →related reading
- The Simple Magic of Consistent Hashing | Mathias Meyerpaperplanes.de
- Parallel Query Processing - Database Systemscs186berkeley.net
- Things to keep in mind while picking a partition key in DynamoDB | by Ekta Garg | Mediummedium.com
- Hash function - Wikipediaen.wikipedia.org
- Notes on Distributed Systems for Young Bloods – Something Similarsomethingsimilar.com
- Introduction to partitioned tables | BigQuery | Google Cloud Documentationcloud.google.com
- Sharding - Database Manual - MongoDB Docsmongodb.com
- Distributed systems for fun and profitbook.mixu.net
- Hash Tablesalgs4.cs.princeton.edu
- KaHyPar - Karlsruhe Hypergraph Partitioning | KaHyPar is a multilevel hypergraph partitioning framework providing direct k-way and recursive bisection based partitioning algorithms that compute solutions of very high quality.kahypar.org
- Introduction to Locality-Sensitive Hashingtylerneylon.com
- MapReduce and Spark - Database Systemscs186berkeley.net