Configure large message payload support in Apigee hybrid

You are currently viewing version 1.15 of the Apigee hybrid documentation. For more information, seeSupported versions.

Overview

Apigee hybrid supports large message payloads up to 30MB. Starting in hybrid 1.15.1, hybrid can allow large message payloads up to 75MB. The default message payload size is 10MB. SeeMessage payload size.

Configure support for message payloads up to 30MB

To enable environments in your hybrid installation to support large message payloads, you need to make the following changes to your runtime configuration:

  • Increase the heap size to at least 4Gi.
  • Increase memory limits to at least 6Gi.
  • Increase memory resource requests to at least 4Gi.
Note: Resources for memory depend on how much head room exists on your nodes.

You can configure these settings for individual environments or for all environments in your installation.

Configure individual environments to support large message payloads

If the proxies configured to support large message payloads have endpoints in only one or a few environments in your installation, you can configure the environments to support large payloads. This avoids adding additional memory to environments that will not need to support large payloads.

To configure individual environments to support large message payloads, you can use theenvs.components.runtime properties. Make the following changes to youroverrides.yaml file:

  1. Add the following stanza to youroverrides.yaml file:
    envs:- name:ENV_NAME  components.    runtime:      cwcAppend:        bin_setenv_max_mem: 4096Mi   # Increase max heap size to 4 gigs      resources:        requests:          memory: 4Gi        limits:          memory: 6Gi
    Important: You must set values for bothenvs.components.runtime.resources.limits.memory andenvs[].components.runtime.resources.requests.memory for this environment. Setting either of the properties for this environment causes Apigee not to use the values of:

    See:

  2. Upgrade theapigee-env chart for each environment you are updating:

    Dry run:

    helm upgradeENV_RELEASE_NAME apigee-env/ \  --install \  --namespaceAPIGEE_NAMESPACE \  --set env=ENV_NAME \  -fOVERRIDES_FILE \  --dry-run=server
    • ENV_RELEASE_NAME is a name used to keep track of installation and upgrades of theapigee-env chart. This name must be unique from the other Helm release names in your installation. Usually this is the same asENV_NAME. However, if your environment has the same name as your environment group, you must use different release names for the environment and environment group, for exampledev-env-release anddev-envgroup-release. For more information on releases in Helm, seeThree big concepts in the Helm documentation.
    • ENV_NAME is the name of the environment you are upgrading.
    • OVERRIDES_FILE is your editedoverrides.yaml file.
  3. Upgrade the chart:

    Dry run:

    helm upgradeENV_RELEASE_NAME apigee-env/ \  --install \  --namespaceAPIGEE_NAMESPACE \  --set env=ENV_NAME \  -fOVERRIDES_FILE

Configure all environments to support large message payloads

Changes to yourruntime stanza will set the heap and memory limits for all environments in your installation. You can override these settings for individual environments with theenvs.components.runtime properties.

  1. Add the following stanza to youroverrides.yaml file:
    runtime:  cwcAppend:    bin_setenv_max_mem: 4096Mi   # Increase max heap size to 4 gigs  resources:    requests:      memory: 4Gi    limits:      memory: 6Gi

    See:

  2. Upgrade theapigee-env chart for each environment in your installation:

    Dry run:

    helm upgradeENV_RELEASE_NAME apigee-env/ \  --install \  --namespaceAPIGEE_NAMESPACE \  --set env=ENV_NAME \  -fOVERRIDES_FILE \  --dry-run=server

    Upgrade the chart:

    helm upgradeENV_RELEASE_NAME apigee-env/ \  --install \  --namespaceAPIGEE_NAMESPACE \  --set env=ENV_NAME \  -fOVERRIDES_FILE

Guidelines for message payloads between 30MB and 75MB

Note: These recommendations apply to Apigee hybrid version 1.15.1 and later.

Determining the optimal heap size for a Message Processor for large payload scenarios depends on your specific use case; however, Apigee offers general guidelines to assist in this process.

Note: These recommendations are intended for large payload requests between 30MB and 75MB for Apigee hybrid.

To calculate heap size per Message Processor (MP), use the following values:

  • Q - Max QPS per MP pod
  • L - Round Trip latency per request (95th percentile of expected latency)
  • C - Total concurrency per MP, the maximum number of requests that can simultaneously persist in the MP at any given time. This is calculated asC = Q * L.
  • P_req - Payload size (in MB) of request sent by Client to Apigee
  • P_resp - Payload size (in MB) of response received from Target
  • S - Safety Factor (Apigee recommends a range of 1.5 - 2)
  • BASE_HEAP - Base heap size to account for non-request related resources such as proxy configurations. (Apigee recommends3072Mi)

Accounting for the safety factorS, along with a base heap size, the total heap per MP is calculated as follows:

Heap size per MP =BASE_HEAP + C * (P_req + P_resp) * S

The base overrides configuration for Large Payload scenario is:

envs:  components:    runtime:      resources:        requests:          cpu: 2000m          memory: 2Gi        limits:          cpu: 4000m          memory: 4Gi      cwcAppend:        bin_setenv_max_mem: 3072Mi # base heap size

Example calculation

The following is an example calculation with the following values:

  • Max QPS,Q:2
  • Latency,L:7s
  • Request payload size,P_req:40MB
  • Response payload size,P_resp:40MB
  • Safety factor,S:1.5
  • Base heap size,BASE_HEAP:3072Mi

Heap size =3072 + (2 * 7) * (40+40) * 1.5 =4752Mi

limits.memory is expected to be 1Gi over the recommended heap.

In this example, you would add the following to youroverrides.yaml:

envs:  components:    runtime:      resources:        requests:          memory: 4Gi        limits:          memory:5.75Gi # approximately 1Gi over 4.75Gi      cwcAppend:        bin_setenv_max_mem:4752Mi

Considerations

Traffic Bursts

HPA ensures that MPs scale as QPS goes up. However, you can expect HPA to take about 60 seconds to trigger scaling up. An unreasonably high burst of traffic can lead to Out of Memory (OOM) errors on your MP.

If you anticipate such bursts of traffic, please scale up heap usage by using a safety factor that seems appropriate. For example,S = 2.

Heap =BASE_HEAP + (Q * L) * (P_req + P_resp) *2

Policy Usage

The calculation above does not include Policy usage. Apigee allows customers to make copies of their request / response payloads and this can significantly alter the heap usage.

For example, if you have a JavaScript policy that makes 3 copies of your entire target response, the equation to use would be:

Heap per MP = Base Heap + (Q * L) * (P_req + P_resp * 4) * S

Example policies that could potentially increase memory usage are:

  • AssignMessage
  • JavaScript Callout
  • JavaCallout

Monitoring

The guidelines provided here are intended to serve as a starting point. Monitoring and alerting of memory usage is highly encouraged. Use an increased Safety Factor if Heap usage is consistently high.

See also:

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.