WSO2 APIM 3.0.0- endpoint connection timeout solution
Problem
Recently I faced a strange issue of connection timeout of my backend API endpoint i.e. due to performance issue of my backend API, WSO2 API manager failed to get a response from my backend API and faulted with 'Connection Timeout' error. Below is the response that my API manager sent when such an issue arises-
Http Code: 500 Response:
<am:fault xmlns:am=\"http://wso2.org/apimanager\">
<am:code>101504</am:code>
<am:type>Status report</am:type>
<am:message>Runtime Error</am:message>
<am:description>Send timeout</am:description>
</am:fault>
Cause
Backend API did not respond within the stipulated time frame due to the performance issue of the backend system or network. The default timeout of any API is 300ms (milliseconds)
Solution
We have to Increase the default timeout duration for APIs so that the connection can wait for a certain duration. This can be achieved in two ways-
1. Per API basis
This can be done using the publisher portal as
a. Open the publisher portal http://host:9443/publisher
b. Login with proper credentials.
e. Now you can change the value to a higher one based on your environment. In addition, you can configure a re-try mechanism from here as well by providing the number of retries and the delay as shown below. Save the settings and you are done.
2. Global Configuration
Global configuration settings will apply the configuration for all APIs. In order to do so, you need yo change your deployment.toml file as-
a. Shutdown the API manager ( <APIM_HOME>/bin/wso2server.sh stop)
b. Open file <APIM_HOME>/repository/conf/deployment.toml
c. Add or change the value of the timeout as follows
[synapse_properties]
synapse.global_timeout_interval = 30000
d. Add or change the socket timeout value as follows
[passthru_http]
http.socket.timeout = 30000
e. Save the file.
f. Start the API manager ( <APIM_HOME>/bin/wso2server.sh start)
Reference- https://apim.docs.wso2.com/en/3.0.0/learn/design-api/endpoints/resiliency/endpoint-timeouts
There are many users who want their payment gateway integration to their online platforms where they accept payments. You need to know all the integration
ReplyDelete