aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2018-05-23 14:16:27 +0000
committerTor Brede Vekterli <vekterli@oath.com>2018-05-23 14:17:29 +0000
commitbf37307fcf6016e06b3450b6ff8d11919d0783d9 (patch)
tree0362c553419d782726d65278a1f1918b87d4962f /storage
parentd3417a2cc400c0d64b71e1cc91fcc032bb8fb3a9 (diff)
Disperse bucket bits using FNV-1 prime when choosing thread stripe
This avoids an inherent affinity between the LSB of a bucket's bits and the stripe an operation ends up on.
Diffstat (limited to 'storage')
-rw-r--r--storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
index 63c957207a6..45ac5ded47f 100644
--- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
+++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h
@@ -190,8 +190,14 @@ public:
std::string dumpQueue() const;
void dumpActiveHtml(std::ostream & os) const;
void dumpQueueHtml(std::ostream & os) const;
+ static uint64_t dispersed_bucket_bits(const document::Bucket& bucket) noexcept {
+ // Disperse bucket bits by multiplying with the 64-bit FNV-1 prime.
+ // This avoids an inherent affinity between the LSB of a bucket's bits
+ // and the stripe an operation ends up on.
+ return bucket.getBucketId().getRawId() * 1099511628211ULL;
+ }
Stripe & stripe(const document::Bucket & bucket) {
- return _stripes[bucket.getBucketId().getRawId()%_stripes.size()];
+ return _stripes[dispersed_bucket_bits(bucket) % _stripes.size()];
}
std::vector<Stripe> & getStripes() { return _stripes; }
private: