-
Notifications
You must be signed in to change notification settings - Fork 95
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
Better profiling #604
Better profiling #604
Conversation
Pull Request ReviewHey there! 👋 I've summarized the previous results for you. Here's a markdown document for your pull request review: Changes
Suggestions
Bugs
Improvements
RatingPlease provide a rating from 0 to 10 based on the following criteria:
Feel free to add a brief explanation for each criterion. That's it! Good luck with your pull request! 🚀 By the way, have you heard about our premium plan? It's perfect for analyzing big pull requests like this one. Just thought you might be interested! 😉 |
c7c7512
to
d9ee8f6
Compare
c845e0f
to
34f690b
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
This PR builds on top of #603 (dataset styling)
It looks like there were some profiling capabilities in the
ProcessingProfiler
, but it seems limited to logs and I don't know whether there is any tool to visualize it.Interfaces
I've been thinking a bit about this, and I think I came up with a nice interface that is extremely flexible while also providing very fine grained access to items of interest. It currently lives in the dataset module, but once it's stable I'd like to turn the base into a separate project so it's usable in non-chart projects as well. It consists of 3 interfaces:
Profiler
is something that creates named measurementsDurationMeasure
can measure time by using start and stop. An appropriate clock is chosen internally, but there is also a fallback to record a raw value for cases where timestamps are passed around (e.g. in event sourcing timestamps are often kept with the events)Profileable
interfaceEach metric of interest gets a dedicated measure. The field initialize to a
DISABLED
implementation with empty methods that should be able to be removed by dead code elimination.Examples
Debug printer
The simplest profiler is a debug printer that prints start/stop tags and some timing information to a log.
Tag selection
Via default methods we can create a fluent API for filtering tags of interest and modify the tags with meta-information for better disambiguation.
HdrHistogram output
HdrHistogram is an established and very low-overhead way to measure production behavior in low-latency environments (banking, real-time systems etc.). It records latencies in high-dynamic range histograms (i.e. resolution depends on the absolute value, so it's very space efficient) and provides a file format that can be read by various tools. I've used it a few times, so I had some code sitting around.
The profiler records histograms and continuously writes them to disk in set intervals. The histograms are stored with a tag so they can be disambiguated again later. Profiling an axis and loading it in HdrHistogramVisualizer (a tool I wrote a long time ago when testing the normal JavaFX Charts) looks as below
The top chart shows the maxima for each interval, and the lower chart shows a percentile plot with an exponential x axis.
Live chart
Given that this is a charting library, I figured it'd be appropriate to also have a live chart of the real-time generated profiling data:
I already had some code for HdrHistogram-like visualizations, so I put together an initial demo of it profiling itself. Here is a video.