Documentation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
jvx:best_practice [2025/05/22 14:15]
admin
jvx:best_practice [2025/06/19 05:31] (current)
admin
Line 2: Line 2:
 ~~Title: JVx Code Snippets~~ ~~Title: JVx Code Snippets~~
  
-==== Configure CG for application ​server ​====+==== Configure CG for application ​servers ​====
  
 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 (available in Java 8 and later)+  * 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>​
  
-  -XX:+UseG1GC ​-XX:​+UnlockExperimentalVMOptions -XX:​+ExplicitGCInvokesConcurrent -XX:+UseStringDeduplication ​-XX:InitiatingHeapOccupancyPercent=+  ​* ZGC //(JVM >= 21, for very large memory configurations,​ needs more memory)// <​code>​-XX:+UseZGC -XX:​+ZGenerational ​-XX:​+UnlockExperimentalVMOptions -XX:​+ExplicitGCInvokesConcurrent -XX:+ZProactive ​-XX:ZCollectionInterval=30</​code>​
-  +
-This will release all the memory sooner or later even when idle (8 minutes)+
  
-ZGC (JVM >11, slightly more memory intensive) +==== Postgresset sequence to max ID ====
-  +
-  -XX:+UseZGC -XX:​+ExplicitGCInvokesConcurrent -XX:​ZCollectionInterval=30 +
- +
-ZGC (JVM >21) +
- +
-  -XX:+UseZGC -XX:​+ZGenerational -XX:​+UnlockExperimentalVMOptions -XX:​+ExplicitGCInvokesConcurrent -XX:​+ZProactive -XX:​ZCollectionInterval=30+
  
 +Use following statement in your postgres database to get a list of **setval** statements which will set the sequences to the max value.
  
 +<code sql>
 +select t.table_name,​
 +       '​SELECT setval(''​seq_'​|| t.table_name || '​_id'',​ max(id)::​integer) FROM ' ||t.table_name
 +  from information_schema.tables t
 + where table_schema = '​public' ​
 +   and table_type = 'BASE TABLE';​
 +</​code>​
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information