Why does Runtime.getRuntime.availableProcessors() always return 1 in OpenShift?

Solution Unverified - Updated -

Issue

  • Why does Runtime.getRuntime.availableProcessors() always return 1 in OpenShift, if both resources.requests.cpu and resources.limits.cpu is unset.
  • If there is no cpu resource setting in the pod, I expect it to return the number of CPUs in the worker host.

Environment

  • OpenJDK
    • OpenJDK 1.8.191+
    • 11
    • -XX:+UseContainerSupport
  • OpenShift
    • 3.11
    • 4.10
    • 4.14+ (cgroupsv2 enabled by default)

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content