-
Notifications
You must be signed in to change notification settings - Fork 174
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
7950: Better DisjointBuilder performance for events not ordered by event end attribute #449
7950: Better DisjointBuilder performance for events not ordered by event end attribute #449
Conversation
👋 Welcome back richardstartin! A progress list of the required criteria for merging this PR into |
ef70fa5
to
13c51a7
Compare
13c51a7
to
fe81e99
Compare
When I wrote the original code in 2010 collisions were rare. I think I saw a few cases of 2-3 lanes (for the same event type and thread), typically when doing recursive events. I wonder what has changed, if this is no longer a case? The JVM usually doesn't write overlapping events. Is it thread buffers coming out of order? |
In our use case this method gets very hot sporadically throughout the day and it depends on the recordings. This tends to show up with custom JFR events which can be committed in any order, but I believe @Gunde has some pathological profiles with only built in events. Having spoken to @Gunde internally, the worst case behaviour of this method is a "known issue" but we're also aware that the one-lane optimisation is very effective for the majority of JFR profiles, so it's important not to regress on common cases. |
@egahlin As far as I've investigated the issue is prevalent in JVM applications running with Amazon Kinesis. It can produce tens of thousands of overlapping File Read events. |
Interesting. I took a look at the FileRead events in the JDK I think I found a bug that could explain the issue:
It should be:
This regression was introduced in JDK 15. I will prepare a fix. Should be backported. The fix to JMC still makes sense. |
@richardstartin This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 5 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@Gunde) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@richardstartin |
/sponsor |
Going to push as commit 5c497ba.
Your commit was automatically rebased without conflicts. |
@Gunde @richardstartin Pushed as commit 5c497ba. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When events are not disjoint and sorted by the end quantity, a lot of time can be spent in
DisjointBuilder.add
. Profiling shows that this is because of the linear search for the first lane ending before the added event starts, and then in the sort afterwards.This patch uses binary search to improve the handling of non-disjoint or non-sorted cases. It also adds checks whether the modification will disrupt descending order to avoid doing any work reordering the array.
With a parameterised benchmark exercising some pathological cases:
Good performance is maintained in the common ascending/disjoint case, but the degenerate cases perform much better:
Before:
After:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jmc pull/449/head:pull/449
$ git checkout pull/449
Update a local copy of the PR:
$ git checkout pull/449
$ git pull https://git.openjdk.org/jmc pull/449/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 449
View PR using the GUI difftool:
$ git pr show -t 449
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jmc/pull/449.diff