Log JVM UseCompressedOops status at startup#19267
Open
mauri870 wants to merge 1 commit into
Open
Conversation
Standardizes with Elasticsearch's startup logging, which surfaces whether compressed ordinary object pointers are enabled or disabled based on the configured heap size.
Contributor
🤖 GitHub commentsJust comment with:
|
Contributor
|
This pull request does not have a backport label. Could you fix it @mauri870? 🙏
|
💛 Build succeeded, but was flaky
Failed CI Steps |
kaisecheng
reviewed
Jul 3, 2026
kaisecheng
left a comment
Contributor
There was a problem hiding this comment.
Overall looks good. Add two suggestion
| let(:args) { ["-t", "-e", "input { } output { }"] } | ||
|
|
||
| it "logs whether compressed ordinary object pointers are enabled" do | ||
| expect(logger).to receive(:info).with("Compressed ordinary object pointers (oops)", hash_including("compressed_oops" => a_string_matching(/\Atrue|false\z/))) |
Contributor
There was a problem hiding this comment.
Suggested change
| expect(logger).to receive(:info).with("Compressed ordinary object pointers (oops)", hash_including("compressed_oops" => a_string_matching(/\Atrue|false\z/))) | |
| expect(logger).to receive(:info).with("Compressed ordinary object pointers (oops)", hash_including("compressed_oops" => a_string_matching(/\A(?:true|false)\z/))) |
Contributor
There was a problem hiding this comment.
| has lower precedence than the anchors here, so /\Atrue|false\z/ actually parses as (\Atrue)|(false\z) eg. "true_garbage" and "garbage_false" would both pass.
| hotspot_diagnostic_bean = ManagementFactory.getPlatformMXBean(com.sun.management.HotSpotDiagnosticMXBean.java_class) | ||
| compressed_oops = hotspot_diagnostic_bean.getVMOption("UseCompressedOops").getValue() | ||
| max_heap_size = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax() | ||
| logger.info("Compressed ordinary object pointers (oops)", "heap.max" => max_heap_size, "compressed_oops" => compressed_oops) |
Contributor
There was a problem hiding this comment.
We can do human readable format for heap size like persisted_queue_config_validator
Need to import "logstash/util/byte_value"
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.
What does this PR do?
Log JVM UseCompressedOops status at startup, standardizes with Elasticsearch's startup logging, which surfaces whether compressed ordinary object pointers are enabled or disabled based on the configured heap size.
Checklist
How to test this PR locally
bin/logstash -e 'input { generator { count => 1 } } output { stdout {} }'Check the startup logs.
To confirm the value flips to
falseabove the ~32GB compressed-oops threshold (needs a machine with enough RAM):Unit test coverage:
Related issues
Logs