Skip to content

Commit

Permalink
Add flag to limit parallelism when linking inputs from filecache. (#7892
Browse files Browse the repository at this point in the history
)
  • Loading branch information
vadimberezniker authored Nov 13, 2024
1 parent 195b423 commit e56f04a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/cache/dirtools/dirtools.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (

var (
enableDownloadCompresssion = flag.Bool("cache.client.enable_download_compression", true, "If true, enable compression of downloads from remote caches")
linkParallelism = flag.Int("cache.client.filecache_link_parallelism", 0, "Number of goroutines to use when linking inputs from filecache. If 0 uses the value of GOMAXPROCS.")
)

func groupIDStringFromContext(ctx context.Context) string {
Expand Down Expand Up @@ -724,7 +725,11 @@ func (ff *BatchFileFetcher) FetchFiles(filesToFetch FileMap, opts *DownloadTreeO
// performance dropping with high parallelism.
linkEG.SetLimit(5)
} else {
linkEG.SetLimit(runtime.GOMAXPROCS(0))
limit := *linkParallelism
if limit == 0 {
limit = runtime.GOMAXPROCS(0)
}
linkEG.SetLimit(limit)
}

fetchQueue := make(chan digestToFetch, 100)
Expand Down

0 comments on commit e56f04a

Please sign in to comment.