heroku / logplex

[DEPRECATED] Heroku log router
Other
981 stars 96 forks source link

Implement batched redis logs writes #245

Closed ypaq closed 6 years ago

ypaq commented 6 years ago

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:

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:

danp commented 6 years ago

LGTM! Tried to walk through the current and new paths, both seem reasonable.

ypaq commented 6 years ago

@danp Thanks for the review!