Trace: • Best practice
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
jvx:best_practice [2025/06/19 05:31] admin |
jvx:best_practice [2025/10/09 09:32] (current) admin |
||
---|---|---|---|
Line 1: | Line 1: | ||
~~NOTRANS~~ | ~~NOTRANS~~ | ||
- | ~~Title: JVx Code Snippets~~ | + | ~~Title: Best practice~~ |
==== Configure CG for application servers ==== | ==== Configure CG for application servers ==== | ||
Line 6: | Line 6: | ||
We didn't find memory leaks in JVx, but sometimes memory consumption is higher than expected. We tried a lot of settings and profiling tools to find problems in JVX, without success. In the end we configured the gc to free memory reliable. With one of our JVM settings, application server memory consumption is as expected: | We didn't find memory leaks in JVx, but sometimes memory consumption is higher than expected. We tried a lot of settings and profiling tools to find problems in JVX, without success. In the end we configured the gc to free memory reliable. With one of our JVM settings, application server memory consumption is as expected: | ||
+ | * G1GC //(for Java 12 and later **recommended**) keeps memory low, good for small and medium memory configurations// <code>-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:+ExplicitGCInvokesConcurrent -XX:G1PeriodicGCInterval=20000 -XX:+G1PeriodicGCInvokesConcurrent</code> | ||
* G1GC //(available in Java 8 and later) memory efficient, good for small memory configurations// <code>-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=1</code> This will release all the memory sooner or later even when idle (8 minutes) | * G1GC //(available in Java 8 and later) memory efficient, good for small memory configurations// <code>-XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=1</code> This will release all the memory sooner or later even when idle (8 minutes) | ||
* ZGC //(JVM >= 11, for very large memory configurations, needs more memory)// <code>-XX:+UseZGC -XX:+ExplicitGCInvokesConcurrent -XX:ZCollectionInterval=30</code> | * ZGC //(JVM >= 11, for very large memory configurations, needs more memory)// <code>-XX:+UseZGC -XX:+ExplicitGCInvokesConcurrent -XX:ZCollectionInterval=30</code> |