Google is committed to advancing racial equity for Black communities. See how.

Enabling G1GC on the Message Processors

This document explains how to enable Garbage First Garbage Collector (G1GC) on the Apigee Edge’s Message Processors.

Apigee Edge’s Message Processor runs on Java Virtual Machine (JVM) and uses the default Garbage Collector—serial or parallel depending on the hardware and operating system configurations. Under certain circumstances and based on your needs, you may want to change the Garbage Collector type used on the Message Processor.

The G1GC is the low-pause, server-style generational garbage collector for Java HotSpot VM which improves the overall performance of the Message Processor. Typically, it is designed for applications with medium-sized to large-sized data sets in which response time is more important than overall throughput. For example: You can consider using G1GC if the heap size is big (greater than 3GB).

It is generally recommended to set another JVM parameter UseStringDeduplicationalong with G1GC. This parameter optimizes the Java heap memory usage by making the duplicate or identical String values share the same character array.

Before you begin

Enabling G1GC on the Message Processors

This section explains how to enable G1GC on the Edge Message Processor. G1GC can be enabled through the property useG1GC on the Message Processor component. By default, this property is set to false on the Message Processors. To configure any property on the Message Processor, use the token according to the syntax described in How to configure Edge.

To enable G1GC on the Message Processors, perform the following steps:

  1. Locate token for useG1GC property
  2. Enable G1GC on Message Processor

Locate token for useG1GC property

The following steps describe how to locate the token for useG1GC property:

  1. Search for the useG1GC property in the Message Processor source directory /opt/apigee/edge-message-processor/source using the following command:
    grep -ri "useG1GC" /opt/apigee/edge-message-processor/source
    
  2. The output of this command shows the token for Message Processor’s property useG1GC as follows:
    /opt/apigee/edge-message-processor/source/conf/system.properties:useG1GC={T}conf_system_useG1GC{/T}
    

    Where the string between the {T}{/T} tags is the name of the token that you can set in the Message Processor's .properties file. Thus, the token for the property useG1GC is as follows:

    conf_system_useG1GC
    

Enable G1GC on the Message Processors

The following steps describe how to enable G1GC on the Apigee Message Processors:

  1. Open the /opt/apigee/customer/application/message-processor.properties file on the Message Processor machine in an editor. If the file does not already exist, then create it. For example:
    vi /opt/apigee/customer/application/message-processor.properties
    
  2. Add the following line to this file:
    conf_system_useG1GC=true
    
  3. Save your changes.
  4. Ensure this properties file is owned by the apigee user. For example:
    chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
    
  5. Restart the Message Processor using the following command:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
    
  6. If you have more than one Message Processor, repeat these steps on all the Message Processors.

Verifying G1GC Configuration on the Message Processors

This section explains how to verify that the G1GC configuration has been successfully modified on the Message Processors.

Even though you use the token conf_system_useG1GC to enable G1GC on the Message Processor, you need to verify that the actual property useG1GC has been set with the new value as follows:

  1. Search for the property useG1GC in the /opt/apigee/edge-message-processor/conf directory and check to see that it has been set with the new value. For example:
    grep -ri "useG1GC" /opt/apigee/edge-message-processor/conf
    
  2. If the G1GC is enabled successfully on the Message Processor, then the previous command shows the new value in the system.properties file.

    The sample result from the previous command, after you have enabled G1GC on the Message Processor, is as follows:

    /opt/apigee/edge-message-processor/conf/system.properties:useG1GC=true
    

    In the example output, note that the property useG1GC has been set with the new value true in system.properties. This indicates that G1GC is successfully enabled on the Message Processor.

  3. If you still see the old value for the property useG1GC, then verify that you have followed all the steps outlined in Enabling G1GC on the Message Processors correctly. If you have missed any step, repeat all the steps again correctly.
  4. If you are still not able to enable G1GC, contact Apigee Support.

What’s next?

Enabling String Deduplication on Message Processors