Some brief background... Since Java 9, G1GC has been the default Garbage Collector for Java. But since G1GC presents unique challenges when used in conjunction with GemFire's heap LRU eviction feature, VMware recommends using other GC algorithms for most applications. See KB article #388242 Heap LRU Eviction With The G1 Garbage Collector if you want more details.
As of GemFire 9.15.x and going forward, GemFire is now compatible with Java 17, and has been validated using ZGC. Thankfully, ZGC is compatible with GemFire Eviction with some very simple configuration settings.
The instructions are very basic, and simply requires that you have a good understanding of your real heap consumption per member.
Example:
Expected Heap Consumption Roughly: 20g
Xmx60g
SoftMaxHeapSize: 22g - 25g range depending on allocation rates
eviction-threshold: 25g - 30g range depending on allocation rates, minimum 3g above the SoftMaxHeapSize.
In the end, this all requires testing with Production like loads as much as possible. The goal is to avoid the need to evict as much as possible, first and foremost. That said, if some burst of activity in the system does drive heap consumption higher, eviction should kick in to protect the system from hitting out of memory issues, allocation stalls, etc.
Final Note: GemFire eviction with overflow to disk evicts ONLY the values, not the keys or the GemFire entry overhead. Heap can continue to increase as the number of entries increases, even for a system configured to evict the values.