The server responds with an HTTP 504 error code when a back-end server is up, and the SE is able to send the request to the back-end server, but the server goes down before it can respond.

The SE waits for a response until the read timeout (1 hour), and responds to the client with the response code 504. Long default idle timeout is observed because the client or the application server closes out the connection in the case of an error.

The parameter upstream_connect_timeout is the idle timeout for back-end connection, and the default value for this timeout is 3600000 ms (1 hour). The default values for the upstream_send_timeout and the upstream_read_timeout is 3600000 ms (1 hour). The timeout value for idle connections on an SE can be changed using the shell prompt.

For more information on the above-mentioned timeout values, see Timeout Values for Backend Servers on Service Engine topic in the VMware NSX Advanced Load BalancerConfiguration Guide.

If the 1-hour timeout value (wait time) for the HTTP 504 response code is not acceptable, follow one of the workaround actions mentioned below:

  1. Solution 1: Change the value of the following timeout options to reduce the HTTP 504 response code wait time using the shell prompt.

    1. upstream_connect_timeout

    2. upstream_send_timeout

    3. upstream_read_timeout

      Use the se_runtime_properties option under the configure serviceengineproperties command.

    #shell
    Login: admin
    Password: 
    [avi-cntrl1]: > configure serviceengineproperties
    [avi-cntrl1]: seproperties> se_runtime_properties
    [avi-cntrl1]: seproperties:se_runtime_properties> upstream_connect_timeout <value> 
    [avi-cntrl1]: seproperties:se_runtime_properties> upstream_send_timeout <value>  
    [avi-cntrl1]: seproperties:se_runtime_properties> upstream_read_timeout <value> 
    Note:

    Changing the value of the above-mentioned timeout options affects all the virtual services on the SE.

  2. Solution 2: Enable Age Out Idle Connections and change the value of Idle Durations using the NSX Advanced Load Balancer UI. Changing Profiles setting options enables the SE to respond with an HTTP 503 response code.

    1. Edit the Profiles option to change the timeout value for the desired virtual services. This option is used when different back-end servers have vastly different behaviors and different timeout values are required for each of them. Navigate to Application > Virtual Services and select the desired virtual service. Click the edit icon.

    2. Choose the drop-down menu for TCP/UDP Profille under the Profiles section.

    3. Select theCustom tab under TCP Proxy Setting section.

    4. Select the Age Out Idle Connections option and set the desired value for Idle Duration. Idle Duration is the duration of the keepalive probes or the timeout values for idle sessions. This value is set in seconds. The minimum value that can be set is 5 seconds, and the maximum value that can be set is 3600 seconds (1 hour). If the value is set to zero, it sets the idle timeout to infinite.

      Note:

      The SEs close the back-end connections if the server is idle for the time equal to, or more than the time configured as Idle Duration. In this case, the SE responds with an HTTP 503 response code.