Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Recommended

We'll recommend resources you may like as you browse. Try these suggestions for now.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

OpenJDK 8u372 to feature cgroup v2 support

April 19, 2023
Severin Gehwolf
Related topics:
JavaKubernetes
Related products:
Red Hat build of OpenJDKRed Hat OpenShiftRed Hat Enterprise Linux

    The control group (cgroup) pseudo filesystem is the key feature enabling resource quotas on containers deployed on Kubernetes. The cgroups filesystem is a Linux kernel feature and comes in one of three forms, depending on the hosts' configuration:

    • cgroup v2, or unified hierarchy
    • cgroup v1, or legacy hierarchy
    • hybrid (basically cgroup v1, but some system services use cgroup v2).

    The state of the art is cgroup v2. With the releases of Red Hat OpenShift 4.12 and Red Hat Enterprise Linux 9, which both feature cgroup v2, it becomes increasingly likely that OpenJDK 8 running in containers runs on a cgroup v2-enabled Linux kernel. Cgroup v1, the current predominant configuration, will become increasingly less frequent in practice as time moves forward.

    OpenJDK 8u372: cgroup v1 and v2 support

    With the release of OpenJDK 8u372 in April 2023, the cgroup v2 support patches present in later JDK releases have been backported to OpenJDK 8. 30 patches in total have been backported so as to bring this feature to OpenJDK 8u. It was added to OpenJDK 8u, a very mature and stable JDK release, under the enhancement exception rule of adapting to new hardware and operating environments.

    Version 8u372 and later will detect the cgroup version in use, v1 or v2, on the host system. Once it detects the version, it looks up the set resource limits via the pseudo filesystem hierarchy and will size its internal resources accordingly. This will ensure that OpenJDK 8 will comply to the set resource limits of containers on cgroup v2 systems, a feature OpenJDK users have grown accustomed to since it was first brought to OpenJDK 8 with the 8u192 release.

    How to see which cgroup version OpenJDK 8u detected

    One easy way to see which cgroup version, if any, OpenJDK 8u detected is by using the -XshowSettings:system Java launcher switch. Example:

    [root@357fec96b37e /]# /opt/jdk8u372/bin/java -XshowSettings:system -version
    Operating System Metrics:
        Provider: cgroupv2
        Effective CPU Count: 3
        CPU Period: 100000us
        CPU Quota: 300000us
        CPU Shares: -1
        List of Processors: N/A
        List of Effective Processors, 4 total: 
        0 1 2 3 
        List of Memory Nodes: N/A
        List of Available Memory Nodes, 1 total: 
        0 
        Memory Limit: 500.00M
        Memory Soft Limit: 0.00K
        Memory & Swap Limit: 500.00M
    
    openjdk version "1.8.0_372-beta"
    OpenJDK Runtime Environment (Temurin)(build 1.8.0_372-beta-202303201451-b05)
    OpenJDK 64-Bit Server VM (Temurin)(build 25.372-b05, mixed mode)

    Another way is to use the -XX:+UnlockDiagnosticVMOptions -XX:+PrintContainerInfo JVM switches in order to see the details of which files are being looked up internally:

    [root@357fec96b37e /]# /opt/jdk8u372/bin/java -XX:+UnlockDiagnosticVMOptions -XX:+PrintContainerInfo -version
    OSContainer::init: Initializing Container Support
    Detected cgroups v2 unified hierarchy
    Path to /cpu.max is /sys/fs/cgroup//cpu.max
    Raw value for CPU quota is: 300000
    CPU Quota is: 300000
    Path to /cpu.max is /sys/fs/cgroup//cpu.max
    CPU Period is: 100000
    Path to /cpu.weight is /sys/fs/cgroup//cpu.weight
    Raw value for CPU Shares is: 100
    CPU Shares is: -1
    CPU Quota count based on quota/period: 3
    OSContainer::active_processor_count: 3
    CgroupSubsystem::active_processor_count (cached): 3
    total physical memory: 5033832448
    Path to /memory.max is /sys/fs/cgroup//memory.max
    Raw value for memory limit is: 524288000
    Memory Limit is: 524288000
    total container memory: 524288000
    total container memory: 524288000
    CgroupSubsystem::active_processor_count (cached): 3
    Path to /cpu.max is /sys/fs/cgroup//cpu.max
    Raw value for CPU quota is: 300000
    CPU Quota is: 300000
    Path to /cpu.max is /sys/fs/cgroup//cpu.max
    CPU Period is: 100000
    Path to /cpu.weight is /sys/fs/cgroup//cpu.weight
    Raw value for CPU Shares is: 100
    CPU Shares is: -1
    CPU Quota count based on quota/period: 3
    OSContainer::active_processor_count: 3
    openjdk version "1.8.0_372-beta"
    OpenJDK Runtime Environment (Temurin)(build 1.8.0_372-beta-202303201451-b05)
    OpenJDK 64-Bit Server VM (Temurin)(build 25.372-b05, mixed mode)

    OpenJDK 8u362 and older: cgroup v1 only

    Older releases of OpenJDK 8u will only be able to detect cgroup v1 systems. Security considerations aside, it's highly encouraged to upgrade to a later release if you are running your containers on recent cloud infrastructure such as OpenShift 4.12. For example, for a 8u362 build of OpenJDK on a cgroup's v2 system, it would look like as if the container detection failed (i.e., no metrics):

    $ ./jdk8u362-b09/bin/java -XshowSettings:system -version
    Operating System Metrics:
        No metrics available for this platform
    openjdk version "1.8.0_362"
    OpenJDK Runtime Environment (Temurin)(build 1.8.0_362-b09)
    OpenJDK 64-Bit Server VM (Temurin)(build 25.362-b09, mixed mode)
    

    Onward to JDK 21

    While it's important to support new computing environments in older JDK releases, the next OpenJDK LTS release, OpenJDK 21, is around the corner and is scheduled to be released in September 2023. JDK 21 includes many more improvements for a better container and cloud experience. So if you are thinking of writing new Java applications, consider targeting JDK 21, and perhaps using Quarkus for the best cloud native experience!

    Looking for more resources? Explore all things Java on Red Hat Developer.

    Last updated: September 19, 2023

    Related Posts

    • Java 17: What’s new in OpenJDK's container awareness

    • Overhauling memory tuning in OpenJDK containers updates

    • The future of Java and OpenJDK updates without Oracle support

    • Migrating from Oracle JDK to OpenJDK on Red Hat Enterprise Linux: What you need to know

    • OpenJDK now available for Windows

    Recent Posts

    • A day in the life of an NVIDIA H100 on Red Hat OpenShift 5

    • Migrate BuildConfigs to builds for Red Hat OpenShift with one plug-in install

    • Run Red Hat Enterprise Linux CoreOS on NVIDIA BlueField DPUs

    • Agent harness engineering: Separating model capabilities from enforcement

    • What's new for developers in Red Hat Enterprise Linux 10.3 and 9.9

    What’s up next?

    Quarkus for Spring Developers

    Learn how to optimize Java for today’s compute and runtime demands with Quarkus—a Kubernetes-native platform. Quarkus for Spring Developers introduces Quarkus to Java developers, with a special eye for helping those familiar with Spring’s conventions make a quick and easy transition.

    Get the e-book
    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI