storeapi: enable batching of series per SeriesResponse#8623
Conversation
|
Benchmark results with fake, repeating labels on my laptop: |
8d67a44 to
ce4289c
Compare
Signed-off-by: adezxc <[email protected]>
Signed-off-by: adezxc <[email protected]>
9b3be60 to
e629f33
Compare
33af256 to
d8b3ac0
Compare
Signed-off-by: adezxc <[email protected]>
There was a problem hiding this comment.
We run this in prod and on the most network intensive machine in sum it reduced network traffic by 10x. It also saved about 5 cores on each machine that has 128 cores. I didn't capture any other metrics but memory usage should also drop because the newest grpc-go version reuses buffers.
Not merging this yet because someone might have some review comments.
We will also need to inevitably enable batching because of grpc/grpc-go#8697 - grpc-go internally uses quite big buffers for decompressing so the messages also need to be bigger. It's probably better to fix this on our side instead of grpc-go where it is unlikely that this will be changed.
|
Is the CPU reduction seen in receivers or queriers? |
|
Queriers, for the main part. I checked the average CPU load for a querier node with/without the batching enabled (1 week interval) and the reduction is around 30%. Query hosts are not capped so Giedrius was only talking about the used core count. A very similar reduction in CPU time is seen for receivers as well Query |
|
Hello! EDIT: now it default to 64 and no prameter is needed. |




This PR adds a
batchfield to theSeriesResponsemessage and allows for sending/receivingmultiple Series per request.
The size of the batch is set using
query.series-response-batch-sizeflag and is included inSeriesRequest.If the StoreAPI is running an older version it will just send series one-by-one, this way keeping backwards-compatibility.
Original suggestion: #7929
Changes
SeriesBatch batchfield toSeriesResponsebatchableServerstruct that accumulates forwarded responses into an array.RespSetand*seriesServer.Sendfunctions to handle batches correctly.Verification
Some tests, benchmarks are included. We are running this change in production for a few weeks and the network savings are big with
query.series-response-batch-size=50, queriers also seem to use a bit less CPU.