battleblow / openjdk-jdk11u

BSD port of OpenJDK 11
GNU General Public License v2.0
9 stars 8 forks source link

Missing feature: Container metrics #56

Open battleblow opened 5 years ago

battleblow commented 5 years ago

Linux provides container metrics via the classes in

src/java.base/linux/classes/jdk/internal/platform/cgroupv1

Can the BSDs generate similar metrics or is this a Linux only feature? This will probably require some familiarity with Docker to produce an answer. If it's a Linux only feature then this should be closed once that is determined, otherwise we should hold it open for a BSD implementation.

klaus4 commented 5 years ago

Docker is of course Linux (& perhaps macos) only FreeBSD jails do not provide orchestration mechanisms to my knowledge. Of course, in a Docker swarm with java VMs, it makes sense to check the Docker Instances, Reporting, and allocate resources. But checking Docker VMs metrics has absolutely nothing to do with BSD. ----- a longer description of the purpose of that Linux-only feature is here : -- https://bugs.openjdk.java.net/browse/JDK-8203357 (click the Description-arrow on that site ) ... well, one of the last sentences in that description is interesting:

In addition to the new internal API, a new java -XshowSettings:system option will be added to allow the reporting of the system metrics.

a -XshowSettings:system- thing for BSD seems interesting...

I know you know how to program something like that, if you haven`t done already ;-)

battleblow commented 5 years ago

I'm not clear what you mean by Docker being Linux only? There is a FreeBSD port (sysutils/docker), although I haven't checked NetBSD and OpenBSD. Are you referring to the JEP that you referenced only supporting Linux?

I haven't played much with it myself yet, I was just wanting to track possible feature gaps and see if this is one. The implementation of -XshowSettings:system looks like it was tracked in this bug: https://bugs.openjdk.java.net/browse/JDK-8204107 (and is Linux only at the moment).

As you indicate, we've already added in a number of different performance metrics to BSD, in particular the JFR work. Getting -XshowSettings:system to produce output on BSD looks tractable. I don't yet know how useful it would be though since I'm not clear on all the use cases. FWIW, on a standard Linux system the output looked like this:

Operating System Metrics:
    Provider: cgroupv1
    Effective CPU Count: 4
    CPU Period: 100000us
    CPU Quota: -1
    CPU Shares: -1
    List of Processors, 4 total: 
    0 1 2 3 
    List of Effective Processors, 4 total: 
    0 1 2 3 
    List of Memory Nodes, 1 total: 
    0 
    List of Available Memory Nodes, 1 total: 
    0 
    CPUSet Memory Pressure Enabled: false
    Memory Limit: Unlimited
    Memory Soft Limit: Unlimited
    Memory & Swap Limit: 0.00K
    Kernel Memory Limit: Unlimited
    TCP Memory Limit: Unlimited
    Out Of Memory Killer Enabled: true
klaus4 commented 5 years ago

Hi, well.. the FreeBSD-Version of docker is completely experimental and afaik not really maintained, I tested it approx. 2 years ago and I would wonder if 1 person in the world used it to run a java VM inside of it.there‘s a Full Featured dockerVersion for Triton OS(Smart os) but not for BSD. I would say BSD doesn‘t have builtin container-orchestration . Thanks for the -XshowSettings:system - output, hm I guess not e xtremely useful for BSDs. Regards

krytarowski commented 5 years ago

As of now there are no containers on NetBSD (except chroot(8) or virtualization).

battleblow commented 5 years ago

Thanks for the input. I think the consensus here is that this isn't particularly useful on BSD. Given that it is currently Linux only as well, I don't see a lot of value in keeping this issue open.

battleblow commented 5 years ago

I'm going to reopen this after further investigation. At least on FreeBSD container metrics make sense with the use of jails. A jailed process can tell if it is jailed and can also tell if it has been limited to a set of CPUs using cpuset. Which would mean partial support for this sort of data. It currently, AFAIK, can't tell if there have been other limits imposed on it (e.g. memory usage) via rctl.