4 ms·
It would be nice to have some kind of cooperative API for runtimes like Java, Go etc to where the OS or container manager can provide watermark hints for the he
by kev009 9y ago
It would be nice to have some kind of cooperative API for runtimes like Java, Go etc to where the OS or container manager can provide watermark hints for the heap size and when to run collections.
- techman9 9y agoHow does the JVM determine the number of cores on a Linux system by default?
- kev009 9y agoI don't know the precise answer off hand, but probably in an OS dependent code path in OpenJDK. I know for instance OpenJDK uses the global sysctl API to get total RAM on a FreeBSD machine. To use jails as multi-tenancy system you therefore want to fake that API out to the resource controled max for the jail.
- joerg84 9y agoOne of the authors here: This is the OpenJDK 8 implementation: http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/tip/src/os/linux/vm/os_linux.cpp#l4967 http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/tip/src/os...
- sitkack 9y agoBased on request traffic or maximum memory? For the JVM there is -Xmx512m to set the max heap size (512MB in this case). Or are you thinking of something more organic so individual containers could overcommit on memory, and the OOM killer would first send a "collect" signal to all the containers that could GC (and also give the memory back).
- kev009 9y agoYes when I say cooperative I mean nice processes are opting in to being told what and when to do something (change heap size, run a light or heavy collection, etc) apart from their own internal view of affairs.
- sitkack 9y agoThere are a couple nice papers on datacenter aware garbage collectors. https://blog.acolyer.org/2015/05/06/blade-a-data-center-garbage-collector/ https://blog.acolyer.org/2015/05/06/blade-a-data-center-garb...
- jerven 9y agoThe JDK10 build released today is a much better Docker friend by taking the docker settings into account while running inside one.
- kev009 9y agoYeah I see that in the post, but to extrapolate my comment, I mean something running in a separate address space that coordinates all garbage collectors across processes/containers. It would necessarily have to be cooperative.