mirror of
https://github.com/octoleo/restic.git
synced 2025-02-09 07:08:28 +00:00
index: slightly reduce Rewrite concurrency
The index operations are likely CPU-bounded. Thus, reduce the concurrency accordingly.
This commit is contained in:
parent
57d69aa640
commit
e52033a8bd
@ -395,8 +395,9 @@ func (mi *MasterIndex) Rewrite(ctx context.Context, repo restic.Unpacked, exclud
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// loading an index can take quite some time such that this can be both CPU- or IO-bound
|
// loading an index can take quite some time such that this is probably CPU-bound
|
||||||
loaderCount := int(repo.Connections()) + runtime.GOMAXPROCS(0)
|
// the index files are probably already cached at this point
|
||||||
|
loaderCount := runtime.GOMAXPROCS(0)
|
||||||
// run workers on ch
|
// run workers on ch
|
||||||
for i := 0; i < loaderCount; i++ {
|
for i := 0; i < loaderCount; i++ {
|
||||||
rewriteWg.Add(1)
|
rewriteWg.Add(1)
|
||||||
@ -467,8 +468,9 @@ func (mi *MasterIndex) Rewrite(ctx context.Context, repo restic.Unpacked, exclud
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// encoding an index can take quite some time such that this can be both CPU- or IO-bound
|
// encoding an index can take quite some time such that this can be CPU- or IO-bound
|
||||||
workerCount := int(repo.Connections()) + runtime.GOMAXPROCS(0)
|
// do not add repo.Connections() here as there are already the loader goroutines.
|
||||||
|
workerCount := runtime.GOMAXPROCS(0)
|
||||||
// run workers on ch
|
// run workers on ch
|
||||||
for i := 0; i < workerCount; i++ {
|
for i := 0; i < workerCount; i++ {
|
||||||
wg.Go(worker)
|
wg.Go(worker)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user