Couchbase Server shards data into what we call vBuckets. We do this by taking the document id, known as the key and applying a cryptographic hash function to the name of the key and apply modulo N (vBuckets). The vBuckets are split evenly across all nodes in a cluster, so in a cluster with 3 Data Nodes, each node will approximately get 341 vBuckets each. We use the CRC32 hash function which mathematically has very even distribution across a given data space. While no hash function is exactly perfect, we find that CRC32 is within single digit % of even distribution of data across the vBuckets. Each time you write a document to a Couchbase Server cluster the CRC32 hash is performed by the client SDK and that is how it knows which shard (vBucket) to place the data into. This article: The distribution of hash function outputs has a good description of how hash functions distribute evenly.
Ian McCloy (Principal Product Manager, Couchbase)