<div dir="ltr"><div class="gmail_default" style="font-family:monospace;font-size:small">Hi Severin,</div><div class="gmail_default" style="font-family:monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace;font-size:small">Thank you for the answer.</div><div class="gmail_default" style="font-family:monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace;font-size:small">I tested the command that you advised on macOS Docker Engine.</div><div class="gmail_default" style="font-family:monospace;font-size:small">```</div><div class="gmail_default" style="font-family:monospace;font-size:small">> docker run --rm -it --cpus 1 -m 1G {image based on OpenJDK 17} java -XshowSettings:system -version<br>Operating System Metrics:<br>    Provider: cgroupv2<br>    Effective CPU Count: 1<br>    CPU Period: 100000us<br>    CPU Quota: 100000us<br>    CPU Shares: -1<br>    List of Processors: N/A<br>    List of Effective Processors, 4 total:<br>    0 1 2 3<br>    List of Memory Nodes: N/A<br>    List of Available Memory Nodes, 1 total:<br>    0<br>    Memory Limit: 1.00G<br>    Memory Soft Limit: 0.00K<br>    Memory & Swap Limit: 2.00G<br><br>openjdk version "17-ea" 2021-09-14<br>OpenJDK Runtime Environment (build 17-ea+14)<br>OpenJDK 64-Bit Server VM (build 17-ea+14, mixed mode, sharing)<br></div><div class="gmail_default" style="font-family:monospace;font-size:small">```</div><div class="gmail_default" style="font-family:monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace;font-size:small">As you guessed, macOS Docker Engine does use cgroups v2 to limit the container's resources.</div><div class="gmail_default" style="font-family:monospace;font-size:small">Then, I think I should just use OpenJDK 17 as the runtime solution.</div><div class="gmail_default" style="font-family:monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace;font-size:small">Thank you for your help!</div><div class="gmail_default" style="font-family:monospace;font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 24, 2022 at 8:53 PM Severin Gehwolf <<a href="mailto:sgehwolf@redhat.com">sgehwolf@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
The code in JDK 17 and JDK 8 isn't 100% aligned. So it's hard to say.<br>
Please check which cgroups version is in use. Best to try with JDK 17<br>
using '-XshowSettings:system' switch when spawning the app. That should<br>
give some clues.<br>
<br>
For example the output here looks like this (note the 'Provider:'<br>
section):<br>
<br>
Operating System Metrics:<br>
    Provider: cgroupv1<br>
    Effective CPU Count: 8<br>
    CPU Period: 100000us<br>
    CPU Quota: -1<br>
    CPU Shares: -1<br>
    List of Processors, 8 total: <br>
    0 1 2 3 4 5 6 7 <br>
    List of Effective Processors, 8 total: <br>
    0 1 2 3 4 5 6 7 <br>
    List of Memory Nodes, 1 total: <br>
    0 <br>
    List of Available Memory Nodes, 1 total: <br>
    0 <br>
    Memory Limit: Unlimited<br>
    Memory Soft Limit: Unlimited<br>
    Memory & Swap Limit: Unlimited<br>
    Maximum Processes Limit: Unlimited<br>
<br>
openjdk version "17.0.4" 2022-07-19<br>
OpenJDK Runtime Environment (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8)<br>
OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8, mixed mode, sharing)<br>
<br>
I'd expect for the affected system to be a cgroups v2 system, which<br>
isn't supported in JDK 8u (yet). See:<br>
<a href="https://bugs.openjdk.org/browse/JDK-8230305" rel="noreferrer" target="_blank">https://bugs.openjdk.org/browse/JDK-8230305</a><br>
<br>
<br>
On Wed, 2022-08-24 at 18:52 +0900, Plenty Su wrote:<br>
> <br>
> I checked the cgroup files in the container. For example, <br>
> ```<br>
> # cat /sys/fs/cgroup/memory.max<br>
> 1073741824<br>
> ```<br>
<br>
memory.max is a cgroups v2 interface file. That suggests whatever macOS<br>
Docker Engine does, it uses some Linux with cgv2 underneath.<br>
<br>
HTH.<br>
<br>
Thanks,<br>
Severin<br>
<br>
</blockquote></div>