-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8320215: HeapDumper can use DumpWriter buffer during merge #18850
Conversation
/label add serviceability |
👋 Welcome back amenkov! A progress list of the required criteria for merging this PR into |
@alexmenkov 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 556 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@alexmenkov |
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.
Looks good.
Ping. Can I get second review please. |
// Use _writer buffer for reading. | ||
while ((cnt = segment_fs.read(_writer->buffer(), 1, _writer->buffer_size())) != 0) { | ||
_writer->set_position(cnt); | ||
_writer->flush(); |
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.
Why flush on each iteration instead of just once after you are done with the loop?
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.
Standard way to use AbstractDumpWriter is to use AbstractDumpWriter::write_XXX
methods (they all call write_raw(const void* s, size_t len)
which copies data from the provided memory to _writer->buffer()
, and flushes when the buffer is full)
This code uses writer internals - on each iteration we read up to 1MB from segment_fs
directly to _writer->buffer()
, so we need to flush it before performing next read, otherwise data in the buffer will be overridden.
I remember experimenting with different buffer sizes and figuring out that 4KB was the sweet spot. We could potentially switch to 1MB, but it would be better if we had some benchmark numbers to back that up. |
My experiments shown that with the fix time of the merge decreased ~5%. |
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 the explanation, looks good then~
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.
Looks good.
/integrate |
Going to push as commit e4fbb15.
Your commit was automatically rebased without conflicts. |
@alexmenkov Pushed as commit e4fbb15. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The fix updates HeapMerger to use writer buffer (no need to copy memory, also writer buffer is 1MB instead of 4KB).
Additionally fixed small issue in FileWriter (looks like
ssize_t
instead ofsize_t
is a typo, the argument should be unsigned)Testing: all HeapDump-related tests on Oracle supported platforms
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18850/head:pull/18850
$ git checkout pull/18850
Update a local copy of the PR:
$ git checkout pull/18850
$ git pull https://git.openjdk.org/jdk.git pull/18850/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18850
View PR using the GUI difftool:
$ git pr show -t 18850
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18850.diff
Webrev
Link to Webrev Comment