Conversation
…ts. Update scripts to include new configurable options for trace and timeline exports. Add required helper scripts and resources.
… Update scripts, timeline viewer, and relevant classes to reflect changes.
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive Java Flight Recorder (JFR) instrumentation to the Netty virtual thread scheduler, along with introducing FIFO and LIFO scheduler variants for performance comparison. The work includes custom JFR events for tracking scheduler activity, integration with the benchmark runner for capturing and analyzing JFR data, and a browser-based timeline viewer for visualizing scheduler behavior.
Changes:
- Introduces five custom JFR events (
NettyRunIo,NettyRunTasks,VirtualThreadTaskRuns,VirtualThreadTaskRun,VirtualThreadTaskSubmit) to instrument scheduler activity - Refactors
EventLoopSchedulerfrom a concrete class to an interface with FIFO and LIFO implementations - Extends
SchedulingContextto track whether tasks are pollers and include scheduler references - Updates all tests to run against both FIFO and LIFO scheduler types
- Adds complete JFR integration to the benchmark runner including event capture, timeline export via
JfrToTimeline.java, and an HTML-based timeline viewer
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/java/io/netty/loom/jfr/*.java | Five new JFR event definitions for scheduler instrumentation |
| core/src/main/java/io/netty/loom/SchedulerJfrUtil.java | Helper utility for begin/commit patterns on JFR events |
| core/src/main/java/io/netty/loom/EventLoopScheduler.java | Refactored from class to interface, with nested SharedRef and SchedulingContext classes |
| core/src/main/java/io/netty/loom/FifoEventLoopScheduler.java | New FIFO implementation with JFR instrumentation |
| core/src/main/java/io/netty/loom/LifoEventLoopScheduler.java | New LIFO implementation with JFR instrumentation |
| core/src/main/java/io/netty/loom/EventLoopSchedulerType.java | New enum for FIFO/LIFO scheduler types |
| core/src/main/java/io/netty/loom/VirtualMultithreadIoEventLoopGroup.java | Updated to support configurable scheduler type |
| core/src/main/java/io/netty/loom/NettyScheduler.java | Updated for new SchedulingContext structure |
| core/src/test/java/io/netty/loom/VirtualMultithreadIoEventLoopGroupTest.java | All tests parameterized to run against both scheduler types |
| benchmark-runner/src/main/java/io/netty/loom/benchmark/runner/HandoffHttpServer.java | Added scheduler type CLI parameter |
| benchmark-runner/scripts/run-benchmark.sh | Comprehensive JFR integration with event selection and timeline export |
| benchmark-runner/scripts/jfr/JfrToTimeline.java | jbang script to convert JFR recordings to compact JSONL timeline format |
| benchmark-runner/scripts/jfr/timeline-viewer.html | Browser-based interactive timeline visualization tool |
| benchmark-runner/scripts/jfr/netty-loom.jfc | Default JFR settings file for Netty Loom events |
| benchmark-runner/README.md | Documentation for JFR configuration and usage |
| README.md | Overview of available JFR events |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
core/src/main/java/io/netty/loom/VirtualMultithreadIoEventLoopGroup.java
Show resolved
Hide resolved
benchmark-runner/src/main/java/io/netty/loom/benchmark/runner/HandoffHttpServer.java
Show resolved
Hide resolved
Update benchmark scripts and README to include `PERF_STAT_ARGS` for additional `perf stat` parameters.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5
I'm still working on:
SchedulingContextchangesjbangscript which process the JFR events to produce additional telemetry/charts and actionable dataThis is meant to understand if it makes sense to modify Netty to improve the "fairness" (see "Pareto Efficiency") of the scheduler vs I/O handling - which is supposed to be fast, but...better make sure it is.
In some later iteration I could provide an additional "context API" to allow binding the JFR events to HTTP request-related context - and even better - creating a custom scheduler for the purpose of instrumenting the built-in one as well too, and compare the two behaviours.