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

Add VGC output for Container #7199

Merged
merged 1 commit into from
Dec 12, 2023
Merged

Conversation

kangyining
Copy link
Contributor

@kangyining kangyining commented Dec 8, 2023

Add two booleans to the VGC's output

  1. addressable Physical Memory
  2. If the JVM is running inside a container, and its memory limit is set

Signed-off-by: Frank Kang [email protected]

@@ -363,6 +363,8 @@ MM_VerboseHandlerOutput::outputInitializedStanza(MM_EnvironmentBase *env, MM_Ver

buffer->formatAndOutput(env, 1, "<system>");
buffer->formatAndOutput(env, 2, "<attribute name=\"physicalMemory\" value=\"%llu\" />", omrsysinfo_get_physical_memory());
buffer->formatAndOutput(env, 2, "<attribute name=\"using container\" value=\"%s\" />", OMR_CGROUP_SUBSYSTEM_MEMORY == omrsysinfo_cgroup_are_subsystems_enabled(OMR_CGROUP_SUBSYSTEM_MEMORY)?"true":"false");
Copy link
Contributor

Choose a reason for hiding this comment

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

The condition should include '&& omrsysinfo_cgroup_is_memlimit_set().

Both conditions must be met before we take the path of 75% rule for containers.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry misread that you broke it into 2 lines...

Copy link
Contributor

@amicic amicic Dec 8, 2023

Choose a reason for hiding this comment

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

I don't know if this check really represent 'using container' , so I'd rather simplify and not report it separately, but combine it with the other one. I think we just want to report here which of the 2 possible heuristics we chose (75% one or 25% one)

But we can hear @dmitripivkine's opinion, too.

Copy link
Contributor

Choose a reason for hiding this comment

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

  • I would not call omrsysinfo_cgroup_is_memlimit_set() in the line below if omrsysinfo_cgroup_are_subsystems_enabled() does not return true. It does not seem intended to be called this way (reports errors in Snap traces).
  • I agree with Aleks we just want to distinguish 75% and 25% cases

Copy link
Contributor

Choose a reason for hiding this comment

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

to be precise there is also case 50% if total memory is less than 1G

Copy link
Contributor

@dmitripivkine dmitripivkine Dec 11, 2023

Choose a reason for hiding this comment

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

... or alternatively just report here in one line "run in container with memlimit set to <value>" (not sure "container" is generalized word enough. Also might be it is a place to report about memlimit value.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm ok with cashing the result of 'container limit set' in GC Ext and using that in VGC.

But I don't think that we need to report what that limit is. That limit already affected omrsysinfo_get_addressable_physical_memory() value (and our internal usablePhysicalMemory cached value) which we should report as a separate line regardless if container limit is set or not (or if it's the same or different value than omrsysinfo_get_physical_memory() value). I think this is just a slightly more generic way of reporting in case omrsysinfo_get_addressable_physical_memory() is affected by some other things than the container limit.

If we are sure that the containter limit is always (the only one) reason that will make omrsysinfo_get_addressable_physical_memory() be different/lower than omrsysinfo_get_physical_memory(), then I'm ok reporting it as a container limit value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Again, the point of the flag is just to clarify why reported maxHeapSize looks like 75/50% (because container limit was set) vs 25% (because container limit was not set) of addressablePhysical memory.

Copy link
Contributor

@dmitripivkine dmitripivkine Dec 11, 2023

Choose a reason for hiding this comment

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

ok, I agree to keep it more general. Should we have formal "selection reason" variable to be reported (there are two settings at the moment, "general" and "container") ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking that same line "container limit set" but value="false" would mean "general/default". Perhaps that line could be slightly formalized (feel free to suggest something specific), but I prefer no new lines to report.

@@ -363,6 +363,8 @@ MM_VerboseHandlerOutput::outputInitializedStanza(MM_EnvironmentBase *env, MM_Ver

buffer->formatAndOutput(env, 1, "<system>");
buffer->formatAndOutput(env, 2, "<attribute name=\"physicalMemory\" value=\"%llu\" />", omrsysinfo_get_physical_memory());
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add another line for omrsysinfo_get_addressable_physical_memory with name="addressablePhysicalMemory"
This is actually a more important one, since this is the one we use for further Xmx/softmx calculations.

@@ -363,6 +363,10 @@ MM_VerboseHandlerOutput::outputInitializedStanza(MM_EnvironmentBase *env, MM_Ver

buffer->formatAndOutput(env, 1, "<system>");
buffer->formatAndOutput(env, 2, "<attribute name=\"physicalMemory\" value=\"%llu\" />", omrsysinfo_get_physical_memory());
buffer->formatAndOutput(env, 2, "<attribute name=\"addressablePhysicalMemory\" value=\"%llu\" />", omrsysinfo_get_addressable_physical_memory());
buffer->formatAndOutput(
env, 2, "<attribute name=\"using container and its memory limit is set\" value=\"%s\" />",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do this as well: #7199 (comment)

In this change that flag would default to false, but you'd need to follow up with another change where some other code sets the value. Specifically for OpenJ9 you'd need a change there (OMR GC does not look into container limit).

Also I prefer a bit shorter name like 'container memory limit set/selected'. The fact that the container limit is set implies that we are using container.

@amicic
Copy link
Contributor

amicic commented Dec 12, 2023

looks good, but update the commit/PR comment

Add two booleans to the VGC's output

1. addressable Physical Memory
2. If the JVM is running inside a container, and its memory limit is set

Signed-off-by: Frank Kang [email protected]
@amicic
Copy link
Contributor

amicic commented Dec 12, 2023

@babsingh please, proceed

@babsingh
Copy link
Contributor

jenkins build all

@babsingh
Copy link
Contributor

Only known failures #6516 and #7181 are seen.

@babsingh babsingh merged commit 1b204d4 into eclipse:master Dec 12, 2023
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants