Write parallel snapshot for higher cardinalities

pull/8856/head
Jason Wilder 2017-09-19 13:03:49 -06:00
parent 0d52b060df
commit 391a6288c6
1 changed files with 10 additions and 6 deletions

View File

@ -704,12 +704,16 @@ func (c *Compactor) WriteSnapshot(cache *Cache) ([]string, error) {
return nil, errSnapshotsDisabled
}
concurrency := cache.Count() / 256000
if concurrency < 1 {
concurrency = 1
}
if concurrency > 4 {
concurrency = 4
concurrency := 1
card := cache.Count()
if card >= 1024*1024 {
concurrency = card / 1024 * 1024
if concurrency < 1 {
concurrency = 1
}
if concurrency > 4 {
concurrency = 4
}
}
splits := cache.Split(concurrency)