<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 5/12/23 10:18 AM, Bruno Borges
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CADKGCndPjYJp2UsXfOzF9=xOJjbhTWM1PK=Y65Or5Fz2QO=Wzw@mail.gmail.com">
      
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr" class="gmail_signature">
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif">Hi folks,</font></div>
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif"><br>
                </font></div>
              <div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif">Looking
                  at the source code, I couldn't identify a way (on tip,
                  or any previous release) to keep container support for
                  memory limit, but disable it for CPU limit.</span><br>
              </div>
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif"><br>
                </font></div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <p>Do you mean you want the app to use as much CPU as available, but
      somehow constrain it so that it will not starve the other apps on
      the same host of CPU time?</p>
    <p>I think this can be done by running your containers with CPU
      shares but without CPU limits.</p>
    <p>We had a bug in interpreting CPU shares such that the JVM will
      under-utilize CPUs when CPU shares have been set. This has been
      fixed in <a class="moz-txt-link-freetext" href="https://bugs.openjdk.org/browse/JDK-8281571">https://bugs.openjdk.org/browse/JDK-8281571</a>. Could you
      check if your JDK has this fix?<br>
    </p>
    <p>Thanks</p>
    <p>- Ioi<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite" cite="mid:CADKGCndPjYJp2UsXfOzF9=xOJjbhTWM1PK=Y65Or5Fz2QO=Wzw@mail.gmail.com">
      <div dir="ltr">
        <div dir="ltr">
          <div dir="ltr">
            <div dir="ltr" class="gmail_signature">
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif">While I could achieve this by not setting
                  a CPU limit in my container orchestration solution
                  (e.g., Kubernetes), it wouldn't necessarily give me
                  what I am looking for: I do want to set a CPU limit at
                  the container level, but I want the JVM to count for
                  all processors in the host/node. While </font><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif">I
                  can manually tweak this by modifying
                  -XX:ActiveProcessorCount, this requires me to know
                  upfront how many processors the Node/Host will have.</span></div>
              <div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><br>
                </span></div>
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif">Additionally, setting </font><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif">-XX:ActiveProcessorCount=-1
                  does not give me the behavior I was expecting either.</span></div>
              <div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><br>
                </span></div>
              <div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif">The
                  reason I raise this is due to the new In-place Pod
                  Resource Resizing feature in Kubernetes 1.27, that
                  allows a pod to change the CPU limit without
                  restarting the pod. See this article for details: </span><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif"><a href="https://medium.com/@karla.saur/trying-out-the-new-in-place-pod-resource-resizing-68a0b3c42b72" moz-do-not-send="true" class="moz-txt-link-freetext">https://medium.com/@karla.saur/trying-out-the-new-in-place-pod-resource-resizing-68a0b3c42b72</a></font></div>
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif"><br>
                </font></div>
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif">In an ideal world, the JVM would
                  dynamically scale its thread pools, GC threads, and
                  other components at JVM and Application level
                  accordingly, but we are not there yet, I believe.</font></div>
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif"><br>
                </font></div>
              <div><font face="Roboto, RobotoDraft, Helvetica, Arial,
                  sans-serif">I'd love to hear what others think.</font></div>
              <div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><br>
                </span></div>
              <div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif">Thanks,</span><br>
              </div>
              <div><span style="font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif">Bruno</span></div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>