Skip to content

Commit

Permalink
Increase number of cache partitions
Browse files Browse the repository at this point in the history
  • Loading branch information
jwilder committed Jan 31, 2017
1 parent 2fe8ed3 commit 278c144
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tsdb/engine/tsm1/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
// testing, a value above the number of cores on the machine does not provide
// any additional benefit. For now we'll set it to the number of cores on the
// largest box we could imagine running influx.
const ringShards = 128
const ringShards = 4096

var (
// ErrSnapshotInProgress is returned if a snapshot is attempted while one is already running.
Expand Down
4 changes: 2 additions & 2 deletions tsdb/engine/tsm1/ring.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// basically defines the maximum number of partitions you can have in the ring.
// If a smaller number of partitions are chosen when creating a ring, then
// they're evenly spread across this many partitions in the ring.
const partitions = 256
const partitions = 4096

// ring is a structure that maps series keys to entries.
//
Expand Down Expand Up @@ -92,7 +92,7 @@ func (r *ring) reset() {
// getPartition retrieves the hash ring partition associated with the provided
// key.
func (r *ring) getPartition(key string) *partition {
return r.continuum[int(uint8(xxhash.Sum64([]byte(key))))]
return r.continuum[int(xxhash.Sum64([]byte(key))%partitions)]
}

// entry returns the entry for the given key.
Expand Down

0 comments on commit 278c144

Please sign in to comment.