app/{vminsert,vmstorage}: add comments on why storage.AddRows() is called without limiting the number of concurrent calls

This commit is contained in:
Aliaksandr Valialkin 2023-01-06 22:40:07 -08:00
parent 5c4bd4f7c1
commit 293e4dc77b
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1
3 changed files with 7 additions and 0 deletions

View file

@ -144,6 +144,9 @@ func (ctx *InsertCtx) FlushBufs() error {
return nil
}
}
// There is no need in limiting the number of concurrent calls to vmstorage.AddRows() here,
// since the number of concurrent FlushBufs() calls should be already limited via writeconcurrencylimiter
// used at every ParseStream() call under lib/protoparser/*/streamparser.go
err := vmstorage.AddRows(ctx.mrs)
ctx.Reset(0)
if err == nil {

View file

@ -111,6 +111,8 @@ func pushAggregateSeries(tss []prompbmarshal.TimeSeries) {
return
}
}
// There is no need in limiting the number of concurrent calls to vmstorage.AddRows() here,
// since the number of concurrent pushAggregateSeries() calls should be already limited by lib/streamaggr.
if err := vmstorage.AddRows(ctx.mrs); err != nil {
logger.Errorf("cannot flush aggregate series: %s", err)
}

View file

@ -147,6 +147,8 @@ var WG syncwg.WaitGroup
var resetResponseCacheIfNeeded func(mrs []storage.MetricRow)
// AddRows adds mrs to the storage.
//
// The caller should limit the number of concurrent calls to AddRows() in order to limit memory usage.
func AddRows(mrs []storage.MetricRow) error {
if Storage.IsReadOnly() {
return errReadOnly