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

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


This document explains how to configure the I/O timeout on Apigee Edge's Routers.


The I/O timeout on the Router represents the time for which the Router waits to receive a
response from the Message Processor, after establishing the connection and sending the request
to the Message Processor. The default value of the I/O timeout on the Router is 57 seconds.


The I/O timeout for Routers can be increased or decreased from the default value of 57 seconds
based on your needs. It can be configured in the following ways:

- In a virtual host
- On the Router


The following properties control the I/O timeout on the Routers:

| Property Name | Location | Description |
|---|---|---|
| `proxy_read_timeout` | Virtual host | Specifies the maximum time for which the Router waits to receive a response from the Message Processor, after establishing the connection and sending the request to the Message Processor. If there is no response from the Message Processor within this timeout period, then the Router times out. By default, this property takes the value set for the `conf_load_balancing_load.balancing.driver.proxy.read.timeout` property on the Router. The default value is **57 seconds**. If this property is modified with a new timeout value for a specific virtual host, then only the API proxies using that specific virtual host are affected. |
| `conf_load_balancing_load.balancing.driver.proxy.read.timeout` | Router | Specifies the maximum time for which the Router waits to receive a response from the Message Processor, after establishing the connection and sending the request to the Message Processor. If there is no response from the Message Processor within this timeout period, then the Router times out. This property is used for all the virtual hosts on this Router. The default value of this property is **57 seconds**. You can either modify this property as explained in [Configuring I/O timeout on Routers](https://docs.apigee.com/how-to-guides/configuring-io-timeout-routers#configiorouter) below, or you can overwrite this value by setting the `proxy_read_timeout` property at the virtual host level. You can set the time interval for this property as something other than seconds using the following notation: ``` ms: milliseconds s:  seconds (default) m:  minutes h:  hours d:  days w:  weeks M:  months (length of 30 days) y:  years (length of 365 days) ``` |
| `conf_load_balancing_load.balancing.driver.nginx.upstream_next_timeout` | Router | Specifies the total time the Router waits to receive a response from all the Message Processors, after establishing the connection and sending the request to each Message Processor. This is applicable when your Edge installation has multiple Message Processors and retry is enabled upon occurrence of errors. It has the value of one of the following: - The current value of `conf_load_balancing_load.balancing.driver.proxy.read.timeout` - The default value of 57 seconds As with the `conf_load_balancing_load.balancing.driver.proxy.read.timeout` property, you can specify time intervals other than the default (seconds). |

## Before you begin

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

- If you aren't familiar with virtual host Properties, read [Virtual host property reference](https://docs.apigee.com/api-platform/fundamentals/virtual-host-property-reference).
- If you aren't familiar with configuring properties for Edge on Private Cloud, read [How to configure
  Edge](https://docs.apigee.com/private-cloud/latest/how-configure-edge).
- Ensure that you follow the [Best practices for configuring I/O timeout](https://docs.apigee.com/how-to-guides/configuring-io-timeout-best-practices) recommendations.

> [!NOTE]
> **Note:** 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).

## Configuring I/O timeout in virtual host

This section explains how to configure I/O timeout in the virtual host associated with an
organization and environment. The I/O timeout can be configured in the virtual host through the
property `proxy_read_timeout`, which represents the I/O timeout value in seconds.

> [!NOTE]
> **Note:** Configuring the I/O timeout in a virtual host overrides the default value (57 seconds) with the new value and affects only the specific API Proxies where the virtual host is used. The rest of the API Proxies continue to use the default I/O timeout value of 57 seconds.

> [!TIP]
> **Required permissions:** To perform this task, you must have the following permissions:
>
> - You need to be an `orgadmin` of the specific organization, or
> - You should be in a custom role with permission to modify the specific virtual host in which you would like to configure the I/O timeout.

You can configure the virtual host using one of the following methods:

- Edge UI
- Edge API

### Edge UI

> [!NOTE]
> **Note:** The virtual host cannot be edited using classic UI. If you don't have access to the new UI, use the Edge API. For more information on the transition to the new UI, see [Transition from Classic Edge UI.](https://docs.apigee.com/api-platform/get-started/transition-from-classic-ui)

To configure the virtual host using the Edge UI, do the following:

1. Login to [Edge UI](https://apigee.com/edge).
2. Navigate to **Admin \> Virtual Hosts**.
3. Select a specific **Environment** where you want to make this change.
4. Select the specific virtual host for which you would like to configure the new I/O timeout value.
5. Under **Properties** , update the **Proxy Read Timeout** value in seconds.

   For example, if you want to change the timeout to 120 seconds, type 120 as shown in the
   following figure:

   ![Proxy read timeout value of 120](https://docs.apigee.com/static/images/ht-io-timeout-configure-routers-image1.png "Edit virtual host")
6. Save the change.

### Edge API

To configure the virtual host using the Edge API, do the following:

1. Get the current virtual host configuration using the [Get virtual host](https://apidocs.apigee.com/docs/virtual-hosts/1/routes/organizations/%7Borg_name%7D/environments/%7Benv_name%7D/virtualhosts/%7Bvirtualhost_name%7D/get) API as shown below:

   **Public Cloud user**

   ```
   curl -v -X GET https//api.enterprise.apigee.com/v1/organizations/{organization-name}/environments/{environment-name}/virtualhosts/{virtualhost-name} -u <username>
                   
   ```

   **Private Cloud user**

   ```
   curl -v -X GET http://<management-host>:<port #>/v1/organizations/{organization-name}/environments/{environment-name}/virtualhosts/{virtualhost-name} -u <username>
                   
   ```

   Where:

   <var translate="no">{organization-name}</var> is the name of the organization

   <var translate="no">{environment-name}</var> is the name of the environment

   <var translate="no">{virtualhost-name}</var> is the name of the virtual host

   **Sample virtualhost configuration**

   ```
       {
         "hostAliases": [
           "api.myCompany,com"
         ],
         "interfaces": [],
         "listenOptions": [],
         "name": "secure",
         "port": "443",
         "retryOptions": [],
         "sSLInfo": {
           "ciphers": [],
           "clientAuthEnabled": "false",
           "enabled": "true",
           "ignoreValidationErrors": false,
           "keyAlias": "myCompanyKeyAlias",
           "keyStore": "ref://myCompanyKeystoreref",
           "protocols": []
         },
         "useBuiltInFreeTrialCert": false
       }
   ```
2. Add the property `proxy_read_timeout` to the existing virtual host configuration JSON payload under `properties` with the value in seconds.

   For example, to change the I/O timeout to 120 seconds, add the `properties`
   code block as shown below:

   **Sample updated virtual host configuration**

   ```
   {
     "hostAliases": [
       "api.myCompany,com",
     ],
     "interfaces": [],
     "listenOptions": [],
     "name": "secure",
     "port": "443",
     "retryOptions": [],
     "properties": {
       "property": [
         {
           "name": "proxy_read_timeout",
           "value": "120"
         }
       ]
     },
     "sSLInfo": {
       "ciphers": [],
       "clientAuthEnabled": "false",
       "enabled": "true",
       "ignoreValidationErrors": false,
       "keyAlias": "myCompanyKeyAlias",
       "keyStore": "ref://myCompanyKeystoreref",
       "protocols": []
     },
     "useBuiltInFreeTrialCert": false
   }
   ```
3. Save the updated virtual host configuration in a file. For example, `virtualhost-payload.json`.
4. Update the `virtualhost` configuration with the change using the [Update a virtual host](https://apidocs.apigee.com/docs/virtual-hosts/1/routes/organizations/%7Borg_name%7D/environments/%7Benv_name%7D/virtualhosts/%7Bvirtualhost_name%7D/put) API as follows:

   **Public Cloud user**

   ```
   curl -v -X POST Content-Type: application/json
   https://api.enterprise.apigee.com/v1/organizations/{organization-name}/environments/{environment-name}/virtualhosts/{virtualhost-name} -d @virtualhost-payload.json -u <username>
               
   ```

   **Private Cloud user**

   ```
   curl -v -X POST Content-Type: application/json
   http://<management-host>:<port #>/v1/organizations/{organization-name}/environments/{environment-name}/virtualhosts/{virtualhost-name} -d @virtualhost-payload.json -u <username>
               
   ```

   Where:

   <var translate="no">{organization-name}</var> is the name of the organization

   <var translate="no">{environment-name}</var> is the name of the environment

   <var translate="no">{virtualhost-name}</var> is the name of the virtual host

## Verifying I/O timeout on virtual hosts

This section explains how to verify that the I/O timeout has been successfully modified on the
virtual host using the Edge API.

> [!NOTE]
> **Note:** Use this procedure to verify that the I/O timeout has been successfully modified on the virtual host whether you used the Edge UI or the Edge API to modify the I/O timeout value.

1. Execute the [Get virtual host](https://apidocs.apigee.com/docs/virtual-hosts/1/routes/organizations/%7Borg_name%7D/environments/%7Benv_name%7D/virtualhosts/%7Bvirtualhost_name%7D/get) API to get the `virtualhost` configuration as shown below:

   **Public Cloud user**

   ```
   curl -v -X GET https://api.enterprise.apigee.com/v1/organizations/{organization-name}/environments/{environment-name}/virtualhosts/{virtualhost-name} -u <username>
                 
   ```

   **Private Cloud user**

   ```
   curl -v -X GET http://<management server-host>:<port #>/v1/organizations/{organization-name}/environments/{environment-name}/virtualhosts/{virtualhost-name} -u <username>
                 
   ```

   Where:

   <var translate="no">{organization-name}</var> is the name of the organization

   <var translate="no">{environment-name}</var> is the name of the environment

   <var translate="no">{virtualhost-name}</var> is the name of the virtual host
2. Verify that the property `proxy_read_timeout `has been set to the new value.

   **Sample updated virtual host configuration**

   ```
   {
     "hostAliases": [
       "api.myCompany,com",
     ],
     "interfaces": [],
     "listenOptions": [],
     "name": "secure",
     "port": "443",
     "retryOptions": [],
     "properties": {
       "property": [
         {
           "name": "proxy_read_timeout",
           "value": "120"
         }
       ]
     },
     "sSLInfo": {
       "ciphers": [],
       "clientAuthEnabled": "false",
       "enabled": "true",
       "ignoreValidationErrors": false,
       "keyAlias": "myCompanyKeyAlias",
       "keyStore": "ref://myCompanyKeystoreref",
       "protocols": []
     },
     "useBuiltInFreeTrialCert": false
   }
   ```

   In the example above, note that the `proxy_read_timeout` has been set with
   the new value of 120 seconds.
3. If you still see the old value for `proxy_read_timeout,`then verify that you have followed all the steps outlined in [Configuring I/O timeout in virtual host](https://docs.apigee.com/how-to-guides/configuring-io-timeout-routers#configiovirtual) correctly. If you have missed any step, repeat all the steps again correctly.
4. If you are still not able to modify the I/O timeout, then contact [Apigee Edge Support](https://docs.apigee.com/api-platform/troubleshoot/support).

## Configuring I/O timeout on Routers

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

This section explains how to configure I/O timeout on the Routers. The I/O timeout can be
configured through the Router property
`conf_load_balancing_load.balancing.driver.proxy.read.timeout`, which represents
the I/O timeout value in seconds.

> [!NOTE]
> **Note:** Since this change is made at the Router level, it is important to note that it affects the I/O timeout of all the API proxies associated with the organizations served by the specific Routers.

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

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

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

   ```
   /opt/apigee/customer/application/router.properties
   ```

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

   ```
   vi /opt/apigee/customer/application/router.properties
   ```
2. Add a line in the following format to the `properties` file, substituting a value for **`time_in_seconds`**:

```
conf_load_balancing_load.balancing.driver.proxy.read.timeout=time_in_seconds
```
3. For example, to change the I/O timeout on the Router to 120 seconds, add the following line:

```
conf_load_balancing_load.balancing.driver.proxy.read.timeout=120
```
4. You can also modify the I/O timeout in minutes. For example, to change the timeout to two minutes, add the following line:

```
conf_load_balancing_load.balancing.driver.proxy.read.timeout=2m
```

> [!NOTE]
> **Note:**
>
> The property `conf_load_balancing_load.balancing.driver.proxy.read.timeout`
> automatically takes the new value set for the property
> `conf_load_balancing_load.balancing.driver.proxy.read.timeout`.
>
> However, if you want to set a new value for the property
> `conf_load_balancing_load.balancing.driver.proxy.read.timeout`,
> then you need to add the following line to the
> `/opt/apigee/customer/application/router.properties` file:
>
> ```
> conf_load_balancing_load.balancing.driver.nginx.upstream_next_timeout=122
> ```
>
> And then, follow the steps outlined below.

5. Save your changes.
6. Ensure this properties file is owned by the `apigee` user as shown below:

   ```
   chown apigee:apigee /opt/apigee/customer/application/router.properties
   ```
7. Restart the Router as shown below:

   ```
   /opt/apigee/apigee-service/bin/apigee-service edge-router restart
   ```
8. If you have more than one Router, repeat the above steps on all the Routers.

## Verifying I/O timeout on the Routers

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

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

Even though you use the token
`conf_load_balancing_load.balancing.driver.proxy.read.timeout` to set the I/O timeout
on the Router, you need to verify if the actual property `proxy_read_timeout` has
been set with the new value.

1. Search for the property `proxy_read_timeout` in the `/opt/nginx/conf.d` directory and check to see if it has been set with the new value as follows:

   ```
   grep -ri "proxy_read_timeout" /opt/nginx/conf.d
   ```
2. If the new I/O timeout value is successfully set on the router, then the above command shows the new value in all the virtual host configuration files. The following is the sample result from the `grep` command above when the
   I/O timeout is 120 seconds:

   ```
   /opt/nginx/conf.d/0-default.conf:proxy_read_timeout 120;
   /opt/nginx/conf.d/0-edge-health.conf:proxy_read_timeout 1s;
   ```

   In the example output above, notice that the property `proxy_read_timeout`
   has been set with the new value 120 in `0-default.conf` which is the
   configuration file for the default virtual host. This indicates that the I/O timeout
   is successfully configured to 120 seconds on the Router.

   > [!NOTE]
   > **Note:** The file `/opt/nginx/conf.d/0-edge-health.conf` is the health check configuration file and the property `proxy_read_timeout` for health check is controlled through a different token.

3. If you still see the old value for the property `proxy_read_timeout`, then verify that you have followed all the steps outlined in [Configuring I/O timeout on Routers](https://docs.apigee.com/how-to-guides/configuring-io-timeout-routers#configiorouter) correctly. If you have missed any step, repeat all the steps again correctly.
4. If you are still not able to modify the I/O timeout, then contact [Apigee Edge Support](https://docs.apigee.com/api-platform/troubleshoot/support).

## What's next?

Learn about [Configuring I/O Timeout in Message Processor](https://docs.apigee.com/how-to-guides/configuring-io-timeout-message-processors)