-
Notifications
You must be signed in to change notification settings - Fork 33
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 Benchmarks for metrics #106
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for opening this up. Super useful!
There are a few things different to the certificate and nio setup that we should change:
- Update the docker files to also run the benchmarks
- For now only collect total allocation metrics
- Provide a similar script to update all benchmark thresholds locally
- Split the benchmark code into the benchmark definition and separate files for the benchmarks under test. NIO and certificates do the same.
- Add documentation to the README how to run those.
Docker scripts have been updated, but having issues with thresholds:
I have done this, and there are 2 implementations for Counter to see on which is the preferred one (one captures the allocation but is slower due to return of the closure). |
I have fixed the SPM error and thresholds are being generated fine now; just need to decide of which code style implementations to keep. |
@FranzBusch , could you have a look at the PR code style that is preferred? |
Benchmarks/Benchmarks/PrometheusBenchmarks/DurationHistogram.swift
Outdated
Show resolved
Hide resolved
@swift-server-bot add to allowlist |
@swift-server-bot test this please |
I'm not sure I understand on what happened with https://ci.swiftserver.group/job/swift-prometheus-soundness-prb/31/ and what other PR state https://ci.swiftserver.group/job/swift-prometheus-soundness-prb/buildTimeTrend ; especially runs 27 and 25 which report the same result. EDIT: fixed |
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.
LGTM from my side! @fabianfett you mind giving this a look?
Anything we can do to help move this forward? |
From my perspective this looks fine, any concerns @FranzBusch @fabianfett ? |
@swift-server-bot test this please |
Failures because of missing baseline: @fabianfett I think had some opinions before we merged here? |
Motivation
Adding benchmark tests in order to aid development and avoid performance regressions.
Benchmark is added in the same fashion as for swift-nio and swift-certifcates.
Modifications
Benchmarks are added for incrementing a counter, gauge, histogram and an export of 5000 metrics from the esystem.
How to execute benchmark
In Xcode can open the project like and use Instruments to profile:
Result
Benchmarks are available, and performance difference between v1 is great which only managed to increment 2-3k times per second.