HTTP Server Reselect

Avi Vantage can be configured to retry an HTTP request that fails or returns one of a set of user-specified error codes from the back-end server. Normally, Avi Vantage forwards these error messages back to the client.

Configurable Options

HTTP server reselect is disabled by default. The feature can be configured within individual pools. For releases prior to 18.1.4, when enabling the HTTP server reselect feature, the error codes that trigger the feature need to be specified. Starting with 18.1.4, specification of status codes is not required for the feature to work in connection/SSH failure scenarios.

Error Codes

The pool configuration specifies the HTTP error response codes that will result in server reselection. The error codes can be specified in any of the following ways:

  • Explicit code number(s): Enter one or more individual error codes (for example, 404).
  • Range of codes: Enter a range within 400-499 or 500-599 (for example, 501-503).
  • Entire block of codes: 4xx or 5xx (for example, 4xx).

Maximum Retries

The default maximum retry setting is 4. Following the first error response, Avi Vantage will resend the request to the pool up to 4 more times, for a total of 5 attempts. Each retry is sent to a different server, and each server can receive only one attempt.

If the setting for maximum retries is higher than the number of enabled and up servers within the pool, each of those servers still receives only one attempt. For example, if maximum retries is set to 4 but the pool has only 3 servers, the maximum number of retries is actually 2. The initial attempt that fails goes to one of the servers, leaving 2 more servers to try. If the second server also sends a 4xx or 5xx error code in response to the request, the request is sent to the last server in the pool. If the last server also sends a 4xx or 5xx, the response from the server is sent back to the client.

Server Retry Timeout

Starting in release 18.1.5 a srv_retry_timeout can be set via the Avi REST API or Avi CLI. To have it take effect, be sure the server_reselect.enabled Boolean is set to True. The timeout’s range is 0-3600000 ms (60 mins). A value of 0 causes the timeout to default to the connection timeout value.

Server Reselection for Idempotent Requests

Currently, HTTP server reselect applies only to idempotent request methods, since a given request of this type always has the same result, even if an identical request is received multiple times by a server. Multiple identical requests of non-idempotent request methods (POST, LOCK, PATCH, and CONNECT) are by definition not guaranteed to have the same effect as a single such request. For this reason, HTTP server reselect is not performed for these request methods.

Configuring HTTP Server Reselect

HTTP server reselect can be enabled on the Advanced tab of the pool configuration.

  1. Navigate to Applications > Pools.
  2. Open the configuration popup for the pool:
    • If enabling the feature in an existing pool, click the edit icon next to the pool name.
    • If creating a new pool, click on Create, then click on the cloud name and click on Next. Enter a name for the pool on the Settings tab, then select the servers on the Servers tab.
  3. Select Advanced to display the tab of advanced options.
  4. Select (check) the HTTP Server Reselect checkbox.
  5. Enter the error response codes that will trigger server reselection.
  6. Save the changes:
    • If creating a new pool, click on Next to review the settings, then click on Save.
    • If editing an existing pool, click on Save.

The following example enables HTTP server reselection for all 4xx error codes:

http-server-reselect

Based on this configuration, if a server in this pool responds to a client request with a 4xx error code, Avi Vantage retries the request by sending it to another server in the pool. Avi Vantage will retry the request up to 4 times (to 4 different servers).

Avi CLI Example

In the below, to draw focus on the parameters of greatest interest, many CLI output lines have been omitted.


[admin:10-10-27-18]: > configure pool vs-test-pool
Updating an existing object. Currently, the object is:
+---------------------------------------+------------------------------------------------+
| Field                                 | Value                                          |
+---------------------------------------+------------------------------------------------+
| uuid                                  | pool-8e91b1a6-17bf-490e-b59a-05efd942a3f6      |
| name                                  | vs-test-pool                                   |
.                                                                                        .
.                                                                                        .
.                                                                                        .
| server_reselect                       |                                                |
|   enabled                             | False                                          |
|   num_retries                         | 4                                              |
|   retry_nonidempotent                 | False                                          |
|   srv_retry_timeout                   | 0 milliseconds                                 |
.                                                                                        .
.                                                                                        .
.                                                                                        .
+---------------------------------------+------------------------------------------------+                                                           
[admin:10-10-27-18]: pool> server_reselect enabled
[admin:10-10-27-18]: pool:server_reselect> srv_retry_timeout 5000
Overwriting the previously entered value for srv_retry_timeout
[admin:10-10-27-18]: pool:server_reselect> save
[admin:10-10-27-18]: pool> exit
+---------------------------------------+------------------------------------------------+
| Field                                 | Value                                          |
+---------------------------------------+------------------------------------------------+
| uuid                                  | pool-8e91b1a6-17bf-490e-b59a-05efd942a3f6      |
| name                                  | vs-test-pool                                   |
.                                                                                        .
.                                                                                        .
.                                                                                        .
| server_reselect                       |                                                |
|   enabled                             | True                                           |
|   num_retries                         | 4                                              |
|   retry_nonidempotent                 | False                                          |
|   srv_retry_timeout                   | 5000 milliseconds                              |
.                                                                                        .
.                                                                                        .
.                                                                                        .
+---------------------------------------+------------------------------------------------+

[admin:10-10-27-18]: > configure pool vs-test-pool server_reselect
[admin:10-10-27-18]: pool:server_reselect> no enabled
+---------------------+-------------------+
| Field               | Value             |
+---------------------+-------------------+
| enabled             | False             |
| num_retries         | 4                 |
| retry_nonidempotent | False             |
| srv_retry_timeout   | 5000 milliseconds |
+---------------------+-------------------+
[admin:10-10-27-18]: pool:server_reselect> srv_retry_timeout 0
Overwriting the previously entered value for srv_retry_timeout
[admin:10-10-27-18]: pool:server_reselect> save
[admin:10-10-27-18]: pool> save
+---------------------------------------+------------------------------------------------+
| Field                                 | Value                                          |
+---------------------------------------+------------------------------------------------+
| uuid                                  | pool-8e91b1a6-17bf-490e-b59a-05efd942a3f6      |
| name                                  | vs-test-pool                                   |
.                                                                                        .
.                                                                                        .
.                                                                                        .
| server_reselect                       |                                                |
|   enabled                             | False                                          |
|   num_retries                         | 4                                              |
|   retry_nonidempotent                 | False                                          |
|   srv_retry_timeout                   | 0 milliseconds                                 |
.                                                                                        .
.                                                                                        .
.                                                                                        .
+---------------------------------------+------------------------------------------------+
[admin:10-10-27-18]: >