The current implementation of writes to redis buffers uses at least one redis command per log message. This PR optimizes for writing to redis buffers in batches which is supposed to reduce the load on the redis instances holding log buffers.
Changes
We have added a control rod batch_redis. When enabled the new code path is used. The control rod can be enabled with:
bin/control_rods enable_batch_redis
and disabled with:
bin/control_rods disable_batch_redis
The new code path is slightly modified from the old one with pre-processing of messages and redis LPUSH command execution as one batch of messages per channel.
The tests have been designed in a way that they execute both paths with the same assertions.
We introduced two new metrics:
message-batch.processed which is a counter for the message batches for redis writes
message-batch.failed which is a counter for failed message batch writes to redis
Rationale
The current implementation of writes to redis buffers uses at least one redis command per log message. This PR optimizes for writing to redis buffers in batches which is supposed to reduce the load on the redis instances holding log buffers.
Changes
We have added a control rod
batch_redis
. When enabled the new code path is used. The control rod can be enabled with:and disabled with:
The new code path is slightly modified from the old one with pre-processing of messages and redis
LPUSH
command execution as one batch of messages per channel.The tests have been designed in a way that they execute both paths with the same assertions.
We introduced two new metrics:
message-batch.processed
which is a counter for the message batches for redis writesmessage-batch.failed
which is a counter for failed message batch writes to redis