Configuring I/O timeout on routers

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

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

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.

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

  • Edge UI
  • Edge API

Edge UI

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

  1. Login to Edge UI.
  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

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

    {organization-name} is the name of the organization

    {environment-name} is the name of the environment

    {virtualhost-name} 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 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:

    {organization-name} is the name of the organization

    {environment-name} is the name of the environment

    {virtualhost-name} 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.

  1. Execute the Get virtual host 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:

    {organization-name} is the name of the organization

    {environment-name} is the name of the environment

    {virtualhost-name} 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 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.

Configuring I/O timeout on Routers

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.

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 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:
  3. conf_load_balancing_load.balancing.driver.proxy.read.timeout=time_in_seconds
    

    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
    

    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
    
  4. Save your changes.
  5. Ensure this properties file is owned by the apigee user as shown below:
    chown apigee:apigee /opt/apigee/customer/application/router.properties
    
  6. Restart the Router as shown below:
    /opt/apigee/apigee-service/bin/apigee-service edge-router restart
    
  7. If you have more than one Router, repeat the above steps on all the Routers.

Verifying I/O timeout on the Routers

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.

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

What’s next?

Learn about Configuring I/O Timeout in Message Processor