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

Document class metadata memory reservation impacts #3266

Merged
merged 4 commits into from
May 12, 2023

Conversation

dbwiddis
Copy link
Member

@dbwiddis dbwiddis commented Mar 7, 2023

Description

The bootstrap.memory_lock=true imposes a hard lower limit on native memory reservation by the JVM, which include 1 GB for class metadata in addition to heap space.

On small VMs (such as t1.micro) with only 1 GB space, this results in out of memory errors.

This change updates the documentation to alert users to this setting.

Issues Resolved

Fixes opensearch-project/OpenSearch#5865

Checklist

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and subject to the Developers Certificate of Origin.
    For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Daniel Widdis <widdis@gmail.com>
@dbwiddis dbwiddis requested a review from a team as a code owner March 7, 2023 20:11
@Naarcha-AWS Naarcha-AWS self-assigned this Mar 8, 2023
@@ -71,6 +71,8 @@ The [sample docker-compose.yml]({{site.url}}{{site.baseurl}}/install-and-configu

Disables swapping (along with `memlock`). Swapping can dramatically decrease performance and stability, so you should ensure it is disabled on production clusters.

Enabling the `bootstrap.memory_lock` setting will cause the JVM to reserve any memory it needs. On VMs with limited memory (such as t2.micro with 1GB) the [default 1GB Class Metadata](https://docs.oracle.com/javase/10/gctuning/other-considerations.htm#JSGCT-GUID-BFB89453-60C0-42AC-81CA-87D59B0ACE2E) native memory reservation result in error due to the lack of native memory. To prevent errors, limit the reserved memory size using `-XX:CompressedClassSpaceSize` or `-XX:MaxMetaspaceSize` and set the size of the Java heap to make sure you have enough system memory.
Copy link

@JeffHuss JeffHuss Apr 7, 2023

Choose a reason for hiding this comment

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

Please remove the reference to t2.micro as that's specific to Amazon and this documentation should be platform agnostic.

For the link (i.e., [default 1GB Class Metadata](https://docs.oracle.com/javase/10/gctuning/other-considerations.htm#JSGCT-GUID-BFB89453-60C0-42AC-81CA-87D59B0ACE2E)) I'm not sure, as a reader, where on that page I'm supposed to look. Ctrl+F looking for 1 GB and 1GB on that page yield no results. Please add context to the link so the reader knows why they're being sent to the other page.

Formal cross-references should also, ideally, match the title of the page you link to. See Source: https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#links

Typo: native memory reservation result in error due to the lack of native memory. Singular "reservation" or wrong conjugated form of the verb "result." Should be "reservations result" or "reservation results."

Also, when describing a unit of measure make sure to add a space between the number and the unit. So 1GB should be written as 1 GB. Source: https://github.com/opensearch-project/documentation-website/blob/main/STYLE_GUIDE.md#numbers-and-measurement

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the review, @JeffH-AWS . I've removed the AWS-specific reference and fixed the grammar. I also changed the link to include terms that would show up in a search on that page, specifically "1 gigabyte (GB)".

I did include "Class Metadata" in the link as well, which is the section on that page relevant to this discussion; and in fact someone tuning memory on a small VM would probably want to read that whole section.

I could not find any other way to more directly reference that content. This link would work on Chrome, but not other browsers.

Let me know if I should change this to something like this:

Enabling the bootstrap.memory_lock setting will cause the JVM to reserve any memory it needs. The Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide section on Class Metadata documents a default 1 gigabyte (GB) Class Metadata native memory reservation. Combined with Java heap, this may result in an error due to the lack of native memory on VMs with less memory than these requirements. To prevent errors, limit the reserved memory size using -XX:CompressedClassSpaceSize or -XX:MaxMetaspaceSize and set the size of the Java heap to make sure you have enough system memory.

Alternate less verbose title: "Java SE Hotspot VM Garbage Collection Tuning Guide"

Choose a reason for hiding this comment

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

That sounds great! Very nice work thanks so much Daniel!

Copy link
Member Author

Choose a reason for hiding this comment

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

That sounds great! Very nice work thanks so much Daniel!

I'm not sure if "that sounds great" is to my proposal in the comment above, or the commit I already pushed?

Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: Daniel Widdis <widdis@gmail.com>
@Naarcha-AWS Naarcha-AWS added the backport 2.7 PR: Backport label for 2.7 label May 12, 2023
@Naarcha-AWS Naarcha-AWS merged commit 5fb54e3 into opensearch-project:main May 12, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 12, 2023
* Document class metadata memory reservation impacts

Signed-off-by: Daniel Widdis <widdis@gmail.com>

* Update index.md

* Address review comments

Signed-off-by: Daniel Widdis <widdis@gmail.com>

* Revise wording for more clarity

Signed-off-by: Daniel Widdis <widdis@gmail.com>

---------

Signed-off-by: Daniel Widdis <widdis@gmail.com>
Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
(cherry picked from commit 5fb54e3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Naarcha-AWS added a commit that referenced this pull request May 15, 2023
* Document class metadata memory reservation impacts



* Update index.md

* Address review comments



* Revise wording for more clarity



---------



(cherry picked from commit 5fb54e3)

Signed-off-by: Daniel Widdis <widdis@gmail.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
harshavamsi pushed a commit to harshavamsi/documentation-website that referenced this pull request Oct 31, 2023
…t#3266)

* Document class metadata memory reservation impacts

Signed-off-by: Daniel Widdis <widdis@gmail.com>

* Update index.md

* Address review comments

Signed-off-by: Daniel Widdis <widdis@gmail.com>

* Revise wording for more clarity

Signed-off-by: Daniel Widdis <widdis@gmail.com>

---------

Signed-off-by: Daniel Widdis <widdis@gmail.com>
Co-authored-by: Naarcha-AWS <97990722+Naarcha-AWS@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.7 PR: Backport label for 2.7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java VM for Docker allocates 1GB memory even if less is specified, unless bootstrap.memory_lock=false
4 participants