lib/promscrape: reduce the number of concurrently executed processScrapedData calls from 2x of the number of CPUs to the number of CPUs

This should reduce the maximum memory usage for processScrapedData() function by 2x.
The only part, which can be IO-bound in the processScrapedData() is pushData() call,
when it buffers data to persistent queue if the remote storage cannot keep up
with the data ingestion speed. In this case it is OK if the scrape pace will be limited.
This commit is contained in:
Aliaksandr Valialkin 2023-01-07 00:14:28 -08:00
parent 5876821a16
commit 0a14b7bb82
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -424,7 +424,7 @@ func (sw *scrapeWork) scrapeInternal(scrapeTimestamp, realTimestamp int64) error
return err
}
var concurrencyLimitCh = make(chan struct{}, 2*cgroup.AvailableCPUs())
var concurrencyLimitCh = make(chan struct{}, cgroup.AvailableCPUs())
func (sw *scrapeWork) processScrapedData(scrapeTimestamp, realTimestamp int64, body *bytesutil.ByteBuffer, err error) (bool, error) {
// This function is CPU-bound, while it may allocate big amounts of memory.