40 ms·
Which JVM options do you use the most?
by nkzd 5mo ago
Which JVM options do you use the most?
- cogman10 5mo agoHeap size, GC algorithm. I suggest most people never touch almost any other options. (Flight recording and heap dumps being the exception).
- marginalia_nu 5mo agoGC threads are generally often useful on multi-tenant systems or machines with many cores, as Java will default-size its thread pools according to the number of logical cores. If the server has 16 or more cores, that's very rarely something you want, especially if you run multiple JVMs on the same host. Not JVM options, but these are often also good to tune: -Djdk.virtualThreadScheduler.parallelism -Djdk.virtualThreadScheduler.maxPoolSize -Djava.util.concurrent.ForkJoinPool.common.parallelism In my experience this often both saves memory and improves performance.
- cyberpunk 5mo agoYou can get into difficulty with kubernetes here, as your jvm will detect all cores on the node but you may have set a resources limit on the pod/whatever, so it’ll assume it can spend more time doing stuff than it actually can, so often times it’s quite necessary to tune some things to prevent excessive switching etc.
- dpratt 5mo agoModern JVMs will detect orchestrator-set cgroup limits and size themselves accordingly. If you, for example, set a cpu limit for a pod to “1”, the JVM will size itself as if it was running on a single core machine.
- cyberpunk 5mo agoTIL, this is great. Thanks, saved me some yaml :}
- vips7L 5mo agoAfaik this was fixed a long time ago.
- EdwardDiego 5mo agoNah they fixed the JVM to be container aware some versions ago - I do remember dealing with this in early Java 8 days, think Java 10 is when it got fixed, and then it was backported to later releases of Java 8.