You're viewing Apigee Edge documentation.
Go to the
Apigee X documentation. info
The API requests made by the client applications flow through various components in Apigee Edge before they reach the backend services. Most client applications expect the responses to these requests to be received in a timely manner.
To achieve timely responses, the I/O timeout values are set in each of the components through which the API requests flow through. If any of the components in the flow take more time than the preceding component, the preceding component times out and responds back with 504 Gateway Timeout errors.
While configuring the timeout, the values should be configured in each of the components with utmost care, otherwise it can lead to 504 Gateway Timeout errors.
This document describes best practices for configuring I/O timeout on various components through which the API requests flow in Apigee Edge.
Best practices for configuring I/O timeout
Consider the following best practices when configuring the I/O timeout:
- First component: Always use the highest timeout on the first component in the API request flow, which is the Client Application in Apigee Edge.
- Last component: Always use the lowest timeout on the last component in the API request flow, which is the Backend Service in Apigee Edge.
- Between components: Ensure that there is a difference of at least 2-3 seconds in the timeout value configured in each component between the first component and the last component in the flow.
- Router: It is always a good practice to configure (modify) the I/O timeout value for
a specific virtual host as opposed to configuring it on the Router. This ensures that the new
timeout value affects only those API Proxies which are using the specific virtual host and
not all the API Proxies being served by the Router.
Configure (modify) the I/O timeout on the Router only when you are absolutely sure that the new I/O timeout value is required or applicable for all the API Proxies running on the Router.
- Message Processor: It is always a good practice to configure (modify) the I/O timeout
value for a specific API proxy as opposed to configuring it on the Message Processor. This
ensures that the new timeout value affects only the specific API proxy and not all the API
proxies being served by the Message Processor.
Configure (modify) the I/O timeout on the Message Processor only when you are absolutely sure that the new I/O timeout value is required or applicable for all the API Proxies running on the Message Processor.
Example scenarios
The scenarios in this section can help you understand how to correctly set the I/O timeout values.
Scenario 1: Requests to Apigee Edge from client applications directly
This section describes the best practices to follow while setting up the timeout values in an Apigee Edge setup where there are no intermediate components between the client application and Apigee Edge and between Apigee Edge and your backend server.
Sample Apigee setup with no intermediate components
If Apigee Edge is set up as shown in the diagram above, with no intermediate components, then use the following best practices:
- The client application is the first component in the flow. The highest timeout value should be set on the client.
- The backend server is the last component in the flow. The lowest timeout value should be set on the backend server.
- Configure the timeout values on each of the components in the following order:
The following example shows timeout values set on the various components as per guidelines given above to avoid any issues:
Scenario 2: Requests to Apigee Edge from client applications through intermediate components
This section describes the best practices to follow while setting up the timeout values in an Apigee Edge setup where there are one or more intermediate components between the client application and Apigee Edge and also between Apigee Edge and your backend server.
The intermediate components can be a load balancer, content delivery network (CDN), NGINX, and so on.
Sample Apigee setup with one intermediate component between Client and Apigee Edge and between Apigee Edge and backend server
If Apigee Edge is set up as shown in the diagram above, with one or more intermediate components, then use the following best practices:
- The client application is the first component in the flow. The highest timeout value should be set on the client.
- The backend server is the last component in the flow. The lowest timeout value should be set on the backend server.
- Configure the timeout values on each of the components, including the intermediate components, in the following order:
The following example shows timeout values set on the various components as per guidelines given above to avoid any issues: