Skip to content

Commit

Permalink
[feature] Allow the Java Garbage Collection implementation to be set.…
Browse files Browse the repository at this point in the history
… Defaults to G1GC.
  • Loading branch information
adamretter committed Apr 9, 2023
1 parent 351a6f7 commit 66ad438
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,16 @@ details.
Memory settings for this eXist-db instance. They map to the Java flags `-Xms`,
`-Xmx`, `-XX:MaxMetaspaceSize` and `-XX:MaxDirectMemorySize`.

exist_mem_gc: 'g1'
exist_mem_g1gc_pausegoal: 200
exist_mem_gcdebug_enable: no
exist_mem_nmt_enable: no
exist_mem_strdedup_enable: yes
exist_mem_niocachetune_enable: no

Special memory settings suited for high-load installations:
* `exist_mem_g1gc_pausegoal` is the value of Java option `-XX:MaxGCPauseMillis`
* `exist_mem_gc` is the garbage collector to use, recognised values are: `serial`, `parallel`, `cms`, `g1`, `z`, and `shenandoah`.
* `exist_mem_g1gc_pausegoal` is the value of Java option `-XX:MaxGCPauseMillis`; only relevant if `exist_mem_gc == 'g1'`.
* `exist_mem_gcdebug_enable` enables GC logging for memory usage analysis
* `exist_mem_nmt_enable` enable Java Native Memory Tracking. **NOTE** ignored for exist 4.x because of conflicts with the YAJSW wrapper
* `exist_mem_strdedup_enable` enables Java String Deduplication
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ exist_mem_max_meta: 1024
exist_mem_max_direct: 1024

# special memory/GC settings
exist_mem_gc: 'g1'
exist_mem_g1gc_pausegoal: 200
exist_mem_gcdebug_enable: no
exist_mem_nmt_enable: no
Expand Down
20 changes: 19 additions & 1 deletion templates/exist.java.options.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,27 @@
-XX:MaxMetaspaceSize={{ exist_mem_max_meta }}m
-XX:MaxDirectMemorySize={{ exist_mem_max_direct }}m

# GC (default G1 GC)
# GC
{% if exist_mem_gc == 'serial' %}
-XX:+UseSerialGC
{% endif %}
{% if exist_mem_gc == 'parallel' %}
-XX:+UseParallelGC
{% endif %}
{% if exist_mem_gc == 'cms' %}
-XX:+UseConcMarkSweepGC
{% endif %}
{% if exist_mem_gc == 'g1' %}
-XX:+UseG1GC
-XX:MaxGCPauseMillis={{ exist_mem_g1gc_pausegoal }}
{% endif %}
{% if exist_mem_gc == 'z' %}
-XX:+UseZGC
{% endif %}
{% if exist_mem_gc == 'shenandoah' %}
-XX:+UseShenandoahGC
{% endif %}

# GC logging/debugging
{% if exist_mem_gcdebug_enable|bool is sameas true %}
-XX:+PrintGCDetails
Expand Down

0 comments on commit 66ad438

Please sign in to comment.