You're viewing **Apigee Edge** documentation.  
[Go to the
**Apigee X** documentation](http://cloud.google.com/apigee/docs). info

> [!NOTE]
> **Note:** The instructions in this document are applicable for Edge Private Cloud users only.


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

- If you aren't familiar with G1GC, read [Getting started with the G1 Garbage Collector](https://www.oracle.com/technetwork/tutorials/tutorials-1876574.html)
- If you aren't familiar with String Deduplication, read [String Deduplication of G1 Garbage Collector](https://javarevisited.blogspot.com/2017/02/use-string-deduplication-to-save-memory-from-duplicates-in-java8.html)
- If you aren't familiar with enabling G1GC on edge Message Processors, read [Enable G1GC on the Message Processors](https://docs.apigee.com/how-to-guides/enabling-g1gc-message-processors).
- If you aren't familiar with configuring properties for Edge on Private Cloud, read [How to configure
  Edge](https://docs.apigee.com/private-cloud/v4.50.00/how-configure-edge).

## 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](https://docs.apigee.com/private-cloud/v4.50.00/how-configure-edge).


To enable String Deduplication on the Message Processors, perform the following steps:

1. [Locate token for useStringDeduplication property](https://docs.apigee.com/how-to-guides/enabling-string-deduplication-message-processors#use-string-ded-token)
2. [Enable useStringDeduplication on Message Processor](https://docs.apigee.com/how-to-guides/enabling-string-deduplication-message-processors#enable-use-string-ded)

> [!TIP]
> **Required permissions:** To perform this task, you must have the following permissions:
>
> - Access to the specific Message Processors where you would like to configure the String Deduplication.
> - Access to create and edit the Message Processor component properties file in the `/opt/apigee/customer/application` folder.

### 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

> [!NOTE]
> **Note:** The String Deduplication feature can be used only with G1 Garbage Collector (G1GC) in Java applications. To enable String Deduplication, you need to have already G1GC enabled or enable both G1GC and String Deduplication together on the Message Processor.


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
   ```

   > [!NOTE]
   > **Note:** If you would like to have both G1GC and String Deduplication enabled together, then add the following lines to `/opt/apigee/customer/application/message-processor.properties`:
   >
   > ```
   > conf_system_useG1GC=true
   > 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](https://docs.apigee.com/how-to-guides/enabling-string-deduplication-message-processors#enable-string-ded-mp) 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](https://cloud.google.com/apigee/support).

## What's next?

[Enable G1GC on the Message Processors](https://docs.apigee.com/how-to-guides/enabling-g1gc-message-processors)