API Gateway Appliance - Garbage Collection / Memory Consumption Considerations
search cancel

API Gateway Appliance - Garbage Collection / Memory Consumption Considerations

book

Article ID: 265909

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

The purpose of this KB Article is to discuss and describe the differences you may see in Gateway Appliance Memory consumption as it relates to Garbage Collection method differences between various Gateway versions.

Key Points:

  1. There are two main Garbage Collection methods on the Gateway Appliance (Parallel and G1GC)
  2. The Parallel method was the default method for Gateway 9.x and the G1GC is now the default method for Gateway 10.x and higher versions. 
  3. Memory consumption of your Gateway process (even on an idle Gateway) will be higher with Gateway 10.x and 11.x due to the newer GCG1 method
  4. Higher memory consumption with GCG1 is not a cause for concern as this is by design for better throughput
  5. Customers may switch between Garbage Collection methods with the configurations referenced in the main article to better tailor their Gateway configurations

 

Environment

Gateway 10.x. 11.x

Resolution

There are two main Garbage Collection Methods that can be used on the Gateway Appliance

  1. Parallel Garbage Collector (ParallelOldGC)
  2. Garbage First (G1) Garbage Collector (G1GC)

Gateway 9.x used the Parallel Garbage Collector (ParallelOldGC) by default and as such the memory consumption behavior of the Gateway was relatively low and would ramp up and down as necessary.

With the release of Gateway 10.0 the default Garbage Collection method was changed to Garbage First (G1) Garbage Collector (G1GC)

Customers may find that their Gateway process memory consumption on Gateway 10.0 with the G1GC Garbage Collection method is much higher than what was seen on the Gateway 9.x with the older Parallel method. 

This is not a cause for concern as the G1GC allocated more Java memory Heap up front for better performance.

However customers are free to choose an configure the Garbage collection method of their choosing to meet their Gateway usage requirements 

Changing between Garbage Collections can be done from the following area of the Gateway documentation:

Garbage Collection Settings

https://techdocs.broadcom.com/us/en/ca-enterprise-software/layer7-api-management/api-gateway/10-0/reference/troubleshoot-the-gateway/optimize-gateway-for-large-file-uploads.html#Garbage%20Collection%20Settings

Garbage Collection Settings
The garbage collection settings were changed to G1GC starting with Gateway version 10.0 to optimize performance; however, Java heap space errors may occur if the files or messages involved are large. If this error occurs, the garbage collection settings can be changed back to ParallelOldGC (i.e., the collector used in Gateway version 9.4 or earlier).

To revert to ParallelOldGC for garbage collection:
  • Log into the Gateway as a root user.
  • Open the following file:
    /opt/SecureSpan/Gateway/runtime/etc/profile.d/appliancedefs.sh
  • Replace the following line:
     
    NODE_OPTS="-Xss256k -XX:+UseG1GC -Xmx${java_ram}k -Xms${java_ram}k -XX:G1HeapRegionSize=${G1HeapRegionSize} -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:InitiatingHeapOccupancyPercent=70 -XX:G1NewSizePercent=20 -XX:G1MaxNewSizePercent=60"
     
    With the following line:
     
    NODE_OPTS="-Xmx${java_ram}k -Xss256k -XX:+UseParallelOldGC"
  • Restart the Gateway for the new garbage collection settings to take effect.

     

    Additional Information

    Here are some additional links to learn more about Java Collection Methods:

    Types of Garbage Collector in Java

    https://opensource.com/article/22/7/garbage-collection-java

    Garbage-First Garbage Collector (G1GC)

    https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/g1_gc.html

    The Parallel Collector

    https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/parallel.html