Merge pull request #9384 from influxdata/jw-wal-cache

Reduce cache partitions
pull/9390/head
Jason Wilder 2018-02-01 08:53:20 -07:00 committed by GitHub
commit e83eca61ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

View File

@ -19,7 +19,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 = 4096
const ringShards = 16
var (
// ErrSnapshotInProgress is returned if a snapshot is attempted while one is already running.

View File

@ -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 = 4096
const partitions = 16
// ring is a structure that maps series keys to entries.
//

View File

@ -12,8 +12,8 @@ func TestRing_newRing(t *testing.T) {
n int
returnErr bool
}{
{n: 1}, {n: 2}, {n: 4}, {n: 8}, {n: 16}, {n: 32}, {n: 64}, {n: 128}, {n: 256},
{n: 0, returnErr: true}, {n: 3, returnErr: true}, {n: 512, returnErr: true},
{n: 1}, {n: 2}, {n: 4}, {n: 8}, {n: 16}, {n: 32, returnErr: true},
{n: 0, returnErr: true}, {n: 3, returnErr: true},
}
for i, example := range examples {

View File

@ -1025,7 +1025,7 @@ type WALSegmentWriter struct {
// NewWALSegmentWriter returns a new WALSegmentWriter writing to w.
func NewWALSegmentWriter(w io.WriteCloser) *WALSegmentWriter {
return &WALSegmentWriter{
bw: bufio.NewWriter(w),
bw: bufio.NewWriterSize(w, 16*1024),
w: w,
}
}