Skip to content
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

Set Netty's maxOrder options to previous default #15925

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

andsel
Copy link
Contributor

@andsel andsel commented Feb 9, 2024

Release notes

Updates Netty's configuration of maxOrder to a previously proven value, if not already customised by the user.

What does this PR do?

Adds a step to the JvmOption parsing tool, which is used to compose the JVM options string to pass down to Logstash at startup.
The added step rework the parsed options to set the allocator max order -Dio.netty.allocator.maxOrder=11 so that the maximum pooled buffer is up to 16MB and not 4MB.
This option is added iff it's not yet specified by the user

Why is it important/What is the impact to the user?

It brings back the performance of Netty based plugins to the same as of Logstash previous of 8.7.0, which introduced an update of Netty library.
With messages bigger then 2Kb each it triggered a problem of using unpooled buffers, which kills performance. With this change it moved back to 8Kb.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • I have added tests that prove my fix is effective or that my feature works

Author's Checklist

  • [ ]

How to test this PR locally

The test splits in 2, verify that the line -Dio.netty.allocator.maxOrder=11 is added when the flag is not in config/jvm.options and verify that if the flag is already present it's not overwritten.
Run Logstash with

bin/logstash -e "input {stdin {}} output {stdout{}}"
  • first test: run Logstash and verify that the log that prints all the flag contains the redefinition of maxOrder
[INFO ][logstash.runner          ][main] JVM bootstrap flags: [-Xms4g,...-Dio.netty.allocator.maxOrder=11...

-second test: edit config/jvm.options and add a custom io.netty.allocator.maxOrder, start Logstash and verify logs contains the definition was added.

Related issues

Use cases

Screenshots

Logs

…ff the user hans't specified anything in his option (both file or LS_JVM_OPTS environment variable)
@andsel andsel added the bug label Feb 9, 2024
@andsel andsel self-assigned this Feb 9, 2024
@andsel andsel marked this pull request as ready for review February 9, 2024 10:22
Copy link

Quality Gate failed Quality Gate failed

Failed conditions

1 New issue
0.0% 0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarLint SonarLint

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @andsel

@andsel
Copy link
Contributor Author

andsel commented Feb 9, 2024

Note for reviewer: the SonarCube report is failing because no tests are run on the jvm-options-parser subproject during PR CI phase.

Copy link
Member

@jsvd jsvd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested manually, LGTM

@jsvd
Copy link
Member

jsvd commented Feb 9, 2024

jvm-options-parser subproject during PR CI phase.

Please open an issue about this, we should fix it, the jvm options parser is self contained enough that running these tests should be done at the PR level

@andsel
Copy link
Contributor Author

andsel commented Feb 9, 2024

#15927 to handle the testing on PR CI

@andsel andsel merged commit 52ce3ff into elastic:main Feb 9, 2024
4 of 5 checks passed
@andsel
Copy link
Contributor Author

andsel commented Feb 9, 2024

@logstashmachine backport 8.12

github-actions bot pushed a commit that referenced this pull request Feb 9, 2024
Updates Netty's configuration of maxOrder to a previously proven value, if not already customised by the user.

Adds a step to the JvmOption parsing tool, which is used to compose the JVM options string to pass down to Logstash at startup.
The added step rework the parsed options to set the allocator max order -Dio.netty.allocator.maxOrder=11 so that the maximum pooled buffer is up to 16MB and not 4MB.
This option is added iff it's not yet specified by the user

(cherry picked from commit 52ce3ff)
@andsel
Copy link
Contributor Author

andsel commented Feb 9, 2024

@logstashmachine backport 7.17

andsel added a commit that referenced this pull request Feb 9, 2024
…default (#15928)

Updates Netty's configuration of maxOrder to a previously proven value, if not already customised by the user.

Adds a step to the JvmOption parsing tool, which is used to compose the JVM options string to pass down to Logstash at startup.
The added step rework the parsed options to set the allocator max order -Dio.netty.allocator.maxOrder=11 so that the maximum pooled buffer is up to 16MB and not 4MB.
This option is added iff it's not yet specified by the user

(cherry picked from commit 52ce3ff)

Co-authored-by: Andrea Selva <selva.andre@gmail.com>
@yaauie yaauie added the v8.13.0 label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle Netty's change of default value for maxOrder
5 participants