app/vmagent: allow bigger number of in-memory blocks for big values of -remoteWrite.queues

This should improve the maximum data ingestion speed for highly-loaded vmagent instances
which run on beefy servers with many CPU cores and big amounts of RAM
This commit is contained in:
Aliaksandr Valialkin 2021-11-05 15:14:49 +02:00
parent 847004fa77
commit e702b7a92f
No known key found for this signature in database
GPG Key ID: A72BEC6CD3D0DED1

View File

@ -172,11 +172,11 @@ func newRemoteWriteCtxs(at *auth.Token, urls []string) []*remoteWriteCtx {
}
maxInmemoryBlocks := memory.Allowed() / len(urls) / *maxRowsPerBlock / 100
if maxInmemoryBlocks > 400 {
if maxInmemoryBlocks / *queues > 100 {
// There is no much sense in keeping higher number of blocks in memory,
// since this means that the producer outperforms consumer and the queue
// will continue growing. It is better storing the queue to file.
maxInmemoryBlocks = 400
maxInmemoryBlocks = 100 * *queues
}
if maxInmemoryBlocks < 2 {
maxInmemoryBlocks = 2