Enabling String Deduplication on the Message Processors

You're viewing Apigee Edge documentation.
Go to the Apigee X documentation.
info

This document explains how to enable String Deduplication on the Apigee Edge’s Message Processors.

String Deduplication is a Java feature that helps you to save memory occupied by duplicate String objects in Java applications. It reduces the memory footprint of String objects in Java heap memory by making the duplicate or identical String values share the same character array.

Apigee Edge Message Processor is a Java-based component. Using String Deduplication in a Message Processor can improve the performance of your API Proxies by reducing the memory usage, especially if the API Proxies make heavy use of Strings.

The String Deduplication feature can be used only with G1 Garbage Collector (G1GC) in Java applications. If you want to enable this feature on the Message Processor, then you need to already have G1GC enabled or enable both G1GC and String Deduplication together on the Message Processor.

Before you begin

Enabling String Deduplication on the Message Processors

This section explains how to enable the String Deduplication feature on the Edge Message Processors. String Deduplication can be enabled through the property useStringDeduplication 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 String Deduplication on the Message Processors, perform the following steps:

  1. Locate token for useStringDeduplication property
  2. Enable useStringDeduplication on Message Processor

Locate token for useStringDeduplication property

The following steps describe how to locate the token for useStringDeduplication:

  1. Search for the useStringDeduplication property in the Message Processor source directory /opt/apigee/edge-message-processor/source using the following command:
    grep -ri "useStringDeduplication" /opt/apigee/edge-message-processor/source
  2. The output of this command shows the token for Message Processor’s property useStringDeduplication as follows:
    /opt/apigee/edge-message-processor/source/conf/system.properties:useStringDeduplication={T}conf_system_useStringDeduplication{/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 useStringDeduplication is as follows:

    conf_system_useStringDeduplication

Enable String Deduplication on the Message Processors

The following steps describe how to enable String Deduplication 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_useStringDeduplication=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 String Deduplication on the Message Processors

This section explains how to verify that the String Deduplication has been successfully enabled on the Message Processors.

Even though you use the token conf_system_useStringDeduplication to enable String Deduplication on the Message Processor, you need to verify that the actual property useStringDeduplication has been set with the new value as follows:

  1. Search for the property useStringDeduplication 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 "useStringDeduplication" /opt/apigee/edge-message-processor/conf
  2. If String Deduplication 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 String Deduplication on the Message Processor is as follows:

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

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

  3. If you still see the old value for the property useStringDeduplication, then verify that you have followed all the steps outlined in Enabling String Deduplication 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 String Deduplication, contact Apigee support.

What’s next?

Enable G1GC on the Message Processors