archiver: Reduce tree saver concurrency

Large amount of tree savers have no obvious benefit, however they can
increase the amount of (potentially large) trees kept in memory.
This commit is contained in:
Michael Eischer 2021-08-07 23:33:43 +02:00
parent bba1e81719
commit fa25d6118e
1 changed files with 6 additions and 3 deletions

View File

@ -128,9 +128,12 @@ func (o Options) ApplyDefaults() Options {
}
if o.SaveTreeConcurrency == 0 {
// use a relatively high concurrency here, having multiple SaveTree
// workers is cheap
o.SaveTreeConcurrency = o.SaveBlobConcurrency * 20
// can either wait for a file, wait for a tree, serialize a tree or wait for saveblob
// the last two are cpu-bound and thus mutually exclusive.
// Also allow waiting for FileReadConcurrency files, this is the maximum of FutureFiles
// which currently can be in progress. The main backup loop blocks when trying to queue
// more files to read.
o.SaveTreeConcurrency = uint(runtime.GOMAXPROCS(0)) + o.FileReadConcurrency
}
return o