Configuring the Router to retry connections to a Message Processor

Edge for Private Cloud v. 4.17.09

Configuring the Router response when a Message Processor is unavailable during a health check

The Router makes a health check to the Message Processor every five seconds to determine if the Message Processor is able to service requests. If a Message Processor goes down, the Router automatically forwards requests to another Message Processor.

You can configure how the Router reacts when the Message Processor goes down by setting the conf_load_balancing_load.balancing.driver.nginx.server.retry property on the Router. That property takes a space-delimited set of values that can include:

  • off: Disable retry, the Router returns a failure code upon a request.
  • http_599: (Default) If the Router receives an HTTP 599 response from the Message Processor, the Router forwards the request to the next Message Processor.

    HTTP 599 is a special response code that is generated by a Message Processor when it is being shutdown. The Message Processor tries to complete all existing requests, but for any new requests it responds with HTTP 599 to signal to the Router to retry the request on the next Message Processor.
  • error: If an error occurred while establishing a connection with the Message Processor, passing a request to it, or reading the response header from it, the Router forwards the request to the next Message Processor.
  • timeout: If a timeout occurs while establishing a connection with the Message Processor, passing a request to it, or reading the response header from it, the Router forwards the request to the next Message Processor.
  • invalid_header: If the Message Processor returned an empty or invalid response, the Router forwards the request to the next Message Processor.
  • http_XXX: If the Message Processor returned a response with HTTP code XXX, the Router forwards the request to the next Message Processor.

To configure the Router:

  1. Edit the /opt/apigee/customer/application/router.properties file (if the file does not exist, create it).
  2. Add the conf_load_balancing_load.balancing.driver.nginx.server.retry property as shown below:
    conf_load_balancing_load.balancing.driver.nginx.server.retry=http_599 error
  3. Make sure the properties file is owned by the 'apigee' user:
    > chown apigee:apigee /opt/apigee/customer/application/router.properties
  4. Restart the Router:
    > /opt/apigee/apigee-service/bin/apigee-service edge-router restart

Configuring the Router timeout when accessing Message Processors as part of an API proxy request

The Edge Router has a preset timeout of 57 seconds when attempting to access a Message Processor as part of handling a request through an API proxy. When that timeout expires, the Router will attempt to connect to another Message Processor, if one is available. Otherwise, it will return an error.

You can use two properties to control this timeout:

  • conf_load_balancing_load.balancing.driver.proxy.read.timeout specifies the wait time, in seconds, for a single Message Processor. The default value is 57 seconds.
  • conf_load_balancing_load.balancing.driver.nginx.upstream_next_timeout specifies the total wait time for all Message Processors, in seconds, when your Edge installation has multiple Message Processors. It has a default value of the current value of conf_load_balancing_load.balancing.driver.proxy.read.timeout, or 57 seconds.

To configure the Router:

  1. Edit the /opt/apigee/customer/application/router.properties file (if the file does not exist, create it).
  2. Set the properties as shown below:
    conf_load_balancing_load.balancing.driver.proxy.read.timeout=120
    conf_load_balancing_load.balancing.driver.nginx.upstream_next_timeout=240
  3. Make sure the properties file is owned by the 'apigee' user:
    > chown apigee:apigee /opt/apigee/customer/application/router.properties
  4. Restart the Router:
    > /opt/apigee/apigee-service/bin/apigee-service edge-router restart