-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RedisTxn storage adapter. #107
base: main
Are you sure you want to change the base?
Conversation
d5b7ee6
to
9257384
Compare
* | ||
* @todo Only summary metrics have been refactored so far. Complete refactor for counter, gauge, and histogram metrics. | ||
*/ | ||
class RedisTxn implements Adapter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adapter is based on RedisNg
and currently, the only changes are in the following methods:
updateSummary()
collectSummaries()
If there is interest from the repo maintainers, I'd like to apply the same style of refactoring for the remaining metric types:
- counters
- gauges
- histograms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All metric types have been optimized. Based on benchmark timing, there may be further opportunity to optimize histograms but that will probably be left as an exercise for a future contributor.
@LKaemmerling You seem like an active maintainer on this project and I was curious to gauge level of interest in a change like this PR. No rush but would love feedback on whether y'all think this is worth pursuing or general advice on making this worth your consideration to merge. |
Hey @arris-ray, this sounds interesting and of course, we (or better said I, as at the moment I'm the only maintainer) are open to every contribution! |
21673b9
to
cd6ca11
Compare
Signed-off-by: Arris Ray <[email protected]> Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]> Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]> Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]> Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
8e18a1b
to
e2c2c8e
Compare
Signed-off-by: Arris Ray <[email protected]>
Signed-off-by: Arris Ray <[email protected]>
ebf6ad9
to
4aa0fc0
Compare
Thanks for the encouragement, @LKaemmerling! This is probably ready for review when you're available. Apologies in advance for the massive changeset. If there's anything I can do to help make the review more manageable, please don't hesitate to ask! |
@LKaemmerling Is there a reason this PR is not being merged other than time? |
Problem
The
RedisNG
storage adapter exhibits significant performance degradation as the number of registered metrics increases. This behavior is most notable with Summary metrics but the statement applies for all metric types. The screenshots below shows {p50, p75, p90, p99} timings for collecting {1000, 2000, 5000, 10000} sample Summary metrics across 10 runs in each case. Generally, we can see it takes roughly 4 seconds for aRedisNG
adapter to collect 10000 summary metrics.This behavior seems to stem from the fact that the collection process for each type of metric involves:
This results in network activity that scales with the number of metrics and becomes prohibitively expensive with thousands or tens-of-thousands of metrics.
Reproducing the Problem
This PR adds a benchmark test which was used to generate the data behind the screenshot above. After running
docker-compose up
to fire up all the configured services, shell into thephpunit
container and run the following command:Once the test completes, it should generate a
benchmark.csv
file in the/var/www/html
directory that you can inspect or import into your favorite spreadsheet for analysis. I've imported a sample run into Google Sheets here for convenience.Proposed Solution
Optimize network communication with Redis such that all update and collect operations occur within a single transaction.
Changelist
RedisTxn
storage adapter and supporting classes which:RedisTxn
storage adapterphp-fpm
Dockerfile to vendor Composer dependencies into the Docker imageBenchmark Timings