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

> [!NOTE]
> **Note:** This document is applicable for Edge Public and Private Cloud users.


This document explains how to configure the I/O timeout for the Apigee Edge Message Processors.


The I/O timeout on the Message Processor represents the time for which the Message Processor
waits either to receive a response from the backend server or for the socket to be ready to write
a request to the backend server, before it times out.


The Message Processor I/O timeout default value is `55 seconds`. This timeout
period is applicable
to the backend servers configured in the target endpoint configuration and in the ServiceCallout
policy of your API proxy.


The I/O timeout for Message Processors can be increased or decreased from the default value of
`55 seconds` based on your needs. It can be configured in the following places:

- In the API proxy
  - Target endpoint
  - ServiceCallout policy
- On the Message Processor


The following properties control the I/O timeout on the Message Processors:

| Property Name | Location | Description |
|---|---|---|
| `io.timeout.millis` | API proxy: - Target endpoint - Service Callout policy | This is the maximum time for which the Message Processor does the following: - Waits to receive a response from the backend server, after establishing the connection and sending the request to the backend server OR - Waits for the socket to be ready for the Message Processor to send the request to the backend server. If there is no response from the backend server within this timeout period, then the Message Processor times out. By default, this property takes the value set for the `HTTPTransport.io.timeout.millis` property on the Message Processor. The default value is `55 seconds`. If this property is modified with a new timeout value for a specific API proxy, then only that API proxy is affected. |
| `HTTPTransport.io.timeout.millis` | Message Processor | This is the maximum time for which the Message Processor does the following: - Waits to receive a response from the backend server, after establishing the connection and sending the request to the backend server OR - Waits for the socket to be ready for the Message Processor to send the request to the backend server. If there is no response from the backend server within this timeout period, then the Message Processor times out. This property is used for all the API Proxies running on this Message Processor. The default value of this property is `55 seconds`. You can either modify this property as explained in [Configuring I/O timeout on Message Processors](https://docs.apigee.com/how-to-guides/configuring-io-timeout-message-processors#configonmp), or you can overwrite this value by setting the `io.timeout.millis` property at the API proxy level. |

> [!NOTE]
> **Note:**
>
> - If the timeout happens on the Message Processor while *reading* the HTTP response, then `504 Gateway Timeout` is returned.
> - If the timeout happens on the Message Processor while *writing* the HTTP request, then `408 Request Timeout` is returned.

## Before you begin


Before you use the steps in this document, be sure you understand the following topics:

- If you aren't familiar with I/O timeout, see the `io.timeout.millis` property description in [TargetEndpoint Transport Property Specification](https://docs.apigee.com/api-platform/reference/endpoint-properties-reference#targetendpointtransportpropertyspecification).
- If you aren't familiar with configuring properties for Edge for Private Cloud, read [How to configure Edge](https://docs.apigee.com/private-cloud/latest/how-configure-edge).
- Ensure that you follow the recommendations in [Best practices for configuring I/O timeout](https://docs.apigee.com/how-to-guides/configuring-io-timeout-best-practices).

> [!NOTE]
> **Note:**
>
>
> **Increasing I/O timeout for an API Proxy:**
>
> - If you want to increase the I/O timeout value above the default value for a specific API Proxy, then you need to increase it in the API proxy (as explained in [Configuring I/O timeout in API proxy](https://docs.apigee.com/how-to-guides/configuring-io-timeout-message-processors#config-io-timeout-api-proxy)). In addition, you need to increase the I/O timeout values on the Router, client and backend server appropriately as documented in [Best practices for configuring I/O timeout](https://docs.apigee.com/how-to-guides/configuring-io-timeout-best-practices).
> - Increasing the I/O timeout value on the Message Processor only, or configuring inappropriate I/O timeout values on Edge components can lead to [504 Gateway Timeout errors](https://docs.apigee.com/api-platform/troubleshoot/runtime/504-gateway-timeout).
>
>
> **Decreasing I/O timeout for an API Proxy:**
>
>
> If you want to decrease the I/O timeout value for a specific API Proxy, then you need to decrease
> it in the API Proxy (as explained in
> [Configuring I/O timeout in API proxy](https://docs.apigee.com/how-to-guides/configuring-io-timeout-message-processors#config-io-timeout-api-proxy). If the timeout on the other components
> (Routers, client and backend) are configured
> appropriately as per the recommendations in
> [Best practices for configuring I/O timeout](https://docs.apigee.com/how-to-guides/configuring-io-timeout-best-practices), then you don't have to make any changes
> in the other components. Otherwise, make the changes appropriately.

## Configuring I/O timeout in API proxy


The I/O timeout can be configured in the following API proxy places:

- Target endpoint
- ServiceCallout policy

### Configuring I/O timeout in target endpoint of API proxy


This section explains how to configure I/O timeout in the target endpoint of your API proxy.
The I/O timeout can be configured through the property `io.timeout.millis`, which
represents the I/O timeout value in milliseconds.

> [!NOTE]
> **Note:** Configuring the I/O timeout in the target endpoint of your API proxy overrides the default value (`55 seconds`) with the new value and affects only the specific API proxy where it is configured. The rest of the API Proxies continue to use the default I/O timeout value of `55 seconds`.

> [!TIP]
> **Required permissions:** To perform this task, you must have edit access permissions to the specific API proxy in which you would like to configure the I/O timeout.

1. In the Edge UI, select the specific API proxy in which you would like to configure the new I/O timeout value.
2. Select the specific target endpoint that you want to modify.
3. Add the property `io.timeout.millis` with an appropriate value under the `<HTTPTargetConnection>` element in the `TargetEndpoint` configuration.
4. For example, to change the I/O Timeout to 120 seconds, add the following block of code:

```
    <Properties>
      <Property name="io.timeout.millis">120000</Property>
    </Properties>
```
5. Since the `io.timeout.millis` property is in milliseconds, the value for 120 seconds is `120000`.
6. The following examples show how to configure the I/O timeout in the target endpoint configuration of your API proxy:
7. **Example target endpoint configuration using URL for backend server**

```
<TargetEndpoint name="default">
  <HTTPTargetConnection>
    <URL>https://mocktarget.apigee.net/json</URL>
    <Properties>
      <Property name="io.timeout.millis">120000</Property>
    </Properties>
  </HTTPTargetConnection>
</TargetEndpoint>
```
8. **Example target endpoint configuration using target server**

```
<TargetEndpoint name="default">
  <HTTPTargetConnection>
    <LoadBalancer>
      <Server name="target1" />
      <Server name="target2" />
    </LoadBalancer>
    <Properties>
      <Property name="io.timeout.millis">120000</Property>
    </Properties>
    <Path>/test</Path>
  </HTTPTargetConnection>
</TargetEndpoint>
```

> [!NOTE]
> **Note:** Property values can be only literals. You cannot set values using variables.

9. Save the changes made to your API proxy.

### Configuring I/O timeout in ServiceCallout policy of API proxy

This section explains how to configure the I/O timeout in the ServiceCallout policy of your
API proxy. The I/O timeout can be configured through either the `<Timeout>` element
or the `io.timeout.millis` property. Both the `<Timeout>` element and the
`io.timeout.millis` property represent the I/O timeout values in milliseconds.

> [!NOTE]
> **Note:** Configuring the I/O timeout in the ServiceCallout policy of the API proxy overrides the default value (`55 seconds`) with the new value and affects only the specific ServiceCallout policy where it is configured. The rest of the ServiceCallout policies and API Proxies continue to use the default I/O timeout value of `55 seconds`.

> [!TIP]
> **Required permissions:** To perform this task, you must have edit access permissions to the specific API proxy in which you would like to configure the I/O timeout for the ServiceCallout policy.


You can configure the I/O timeout in the ServiceCallout policy using one of the following methods:

- `<Timeout>` element.
- `io.timeout.millis` property.

#### Timeout element


To configure the I/O timeout in the ServiceCallout policy using the `<Timeout>`
element, do the following:

1. In the Edge UI, select the specific API proxy in which you would like to configure the new I/O timeout value for the ServiceCallout policy.
2. Select the specific ServiceCallout policy that you want to modify.
3. Add the element `<Timeout>` with an appropriate value under the `<ServiceCallout>` configuration.


   For example, to change the I/O timeout to 120 seconds, add the following line of code:

   ```
       <Timeout>120000</Timeout>
   ```

   Since the `<Timeout>` element is in milliseconds, the value for
   120 seconds is `120000`.

   The following example shows how to configure the I/O timeout in the ServiceCallout
   policy using the `<Timeout>` element:

   **Example ServiceCallout policy configuration using URL for backend server**

   ```
   <ServiceCallout name="Service-Callout-1">
       <DisplayName>ServiceCallout-1</DisplayName>
       <Timeout>120000</Timeout>
       <HTTPTargetConnection>
           <Properties/>
           <URL>https://mocktarget.apigee.net/json</URL>
       </HTTPTargetConnection>
   </ServiceCallout>
   ```
4. Save the changes made to your API proxy.

#### io.timeout.millis property

To configure the I/O timeout in the ServiceCallout policy using the
`io.timeout.millis` property, do the following:

1. In the Edge UI, select the specific API proxy in which you would like to configure the new I/O timeout value for the ServiceCallout policy.
2. Select the specific ServiceCallout policy that you want to modify.
3. Add the property `io.timeout.millis` with an appropriate value under the `<HTTPTargetConnection>` element in the TargetEndpoint configuration.

   For example, to change the I/O timeout to 120 seconds, add the following block
   of code:

   ```
       <Properties>
         <Property name="io.timeout.millis">120000</Property>
       </Properties>
   ```

   Since the `io.timeout.millis` property is in milliseconds, the value for
   120 seconds is `120000`.

   The following examples show how to configure the I/O timeout in the target endpoint
   configuration of your API proxy:

   **Example ServiceCallout policy configuration using URL for backend server**

   ```
   <ServiceCallout name="Service-Callout-1">
       <DisplayName>ServiceCallout-1</DisplayName>
       <HTTPTargetConnection>
         <Properties>
           <Property name="io.timeout.millis">120000</Property>
         </Properties>
         <URL>https://mocktarget.apigee.net/json</URL>
       </HTTPTargetConnection>
   </ServiceCallout>
   ```

   **Example ServiceCallout policy configuration using target server**

   ```
   <ServiceCallout enabled="true" name="Service-Callout-1">
       <DisplayName>ServiceCallout-1</DisplayName>
       <Response>calloutResponse</Response>
       <HTTPTargetConnection>
           <LoadBalancer>
               <Server name="target1" />
               <Server name="target2" />
           </LoadBalancer>
           <Properties>
               <Property name="io.timeout.millis">120000</Property>
           </Properties>
           <Path>/test</Path>
       </HTTPTargetConnection>
   </ServiceCallout>
   ```

   > [!NOTE]
   > **Note:**Property values can be only literals. You cannot set values using variables.

4. Save the changes made to your API proxy.

## Configuring I/O timeout on Message Processors

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

This section explains how to configure the I/O timeout on the Message Processors.
The I/O timeout can be configured through the property `HTTPTransport.io.timeout.millis`,
which represents the I/O timeout value in milliseconds on the Message Processor component,
using the token as per the syntax described in
[How to configure
Edge](https://docs.apigee.com/private-cloud/latest/how-configure-edge).

> [!NOTE]
> **Note:** If a change is made at the Message Processor level, it is important to note that it affects the I/O timeout of all the API proxies associated with the organizations and environments served by the specific Message Processors.

> [!TIP]
> **Required permissions:** To perform this task, you must have the following permissions:
>
> 1. Access to the specific Message Processor, where you would like to configure the I/O timeout.
> 2. Access to create or edit the Message Processor component properties file in the `/opt/apigee/customer/application` folder.


To configure the I/O timeout on the Message Processors, do the following:

1. On the Message Processor machine, open the following file in an editor. If it does not already exist, then create it.

   ```
   /opt/apigee/customer/application/message-processor.properties
   ```

   For example, to open the file using
   `https://en.wikipedia.org/wiki/Vi`, enter the following command:

   ```
   vi /opt/apigee/customer/application/message-processor.properties
   ```
2. Add a line in the following format to the properties file, substituting a value for <var translate="no">TIME_IN_MILLISECONDS</var>:

   ```
   conf_http_HTTPTransport.io.timeout.millis=TIME_IN_MILLISECONDS
   ```

   For example, to change the I/O timeout on the Message Processor to 120 seconds,
   add the following line:

   ```
   conf_http_HTTPTransport.io.timeout.millis=120000
   ```
3. Save your changes.
4. Ensure the properties file is owned by the `apigee` user as shown below:

   ```
   chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
   ```
5. Restart the Message Processor as shown below:

   ```
   /opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
   ```
6. If you have more than one Message Processor, repeat the above steps on all the Message Processors.

## Verifying I/O timeout on Message Processors

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


This section explains how to verify that the I/O timeout has been successfully modified on the
Message Processors.


Even though you use the token `conf_http_HTTPTransport.io.timeout.millis` to set the
I/O timeout on the Message Processor, you need to verify if the actual property
`HTTPTransport.io.timeout.millis` has been set with the new value.

1. On the Message Processor machine, search for the property `HTTPTransport.io.timeout.millis` in the `/opt/apigee/edge-message-processor/conf` directory and check to see if it has been set with the new value as shown below:

   ```
   grep -ri "HTTPTransport.io.timeout.millis" /opt/apigee/edge-message-processor/conf
   ```
2. If the new I/O timeout value is successfully set on the Message Processor, then the above command shows the new value in the `http.properties` file.
3. The sample result from the above command after you have configured I/O timeout to 120 seconds is as follows:

```
/opt/apigee/edge-message-processor/conf/http.properties:HTTPTransport.io.timeout.millis=120000
```
4. In the example output above, notice that the property `HTTPTransport.io.timeout.millis` has been set with the new value `120000` in `http.properties`. This indicates that the I/O timeout is successfully configured to 120 seconds on the Message Processor.
5. If you still see the old value for the property `HTTPTransport.io.timeout.millis`, then verify that you have followed all the steps outlined in [Configuring I/O timeout on Message Processors](https://docs.apigee.com/how-to-guides/configuring-io-timeout-message-processors#configonmp) correctly. If you have missed any step, repeat all the steps again correctly.
6. If you are still not able to modify the I/O timeout, then please contact [Apigee Edge Support](https://docs.apigee.com/api-platform/troubleshoot/support).

## What's next?

Learn about
[Configuring I/O timeout on Routers](https://docs.apigee.com/how-to-guides/configuring-io-timeout-routers)