504 GateWay Time-Out error in api.

Hi All,

1.I have created a api with no target and calling the backend service with serviceCallout Policy.

2.I am getting response with in 2 to 3 min,so i configured <Timeout>300000</Timeout>.

3.I am getting sucessfully the response from ServiceCallout after that

.I am doing filter operation using javascript policy with response(Size is 14MB).

4.while hitting the api from postman i am facing 504 gate way error with time span of 1 minute.If response is getting with in 1 minute it is displaying data.

5. i enabled the streaming and configured the properties io.timeout then i am not facing the error,

but i need to filter the data after getting response.

6.By enabling streaming no other policy will work to modify response.

suggest the best way to slove this issue.

0 1 953
1 REPLY 1

As you have already identified it is not possible to process response message payload when streaming is enabled.

Since the message payload size is quite large, the best option for optimizing performance of the API proxy and API gateway runtime might be to enable streaming and avoid processing the message payload.

Nevertheless, if it is a must to read the message payload, we may need to increase both target endpoint timeout and virtual host timeouts accordingly. This option will consume more memory in Apigee Message Processors, keep HTTP client threads of Apigee Message Processors busy for a longer time period, and increase total response time.

In summary, it might be better to use streaming when response payload is considerably large. Hence, it would be better to rethink about this requirement and if possible move mediation logic to the target endpoint. If that's not possible, may need to compromise performance and increase both target endpoint timeout and virtual host timeouts accordingly.

https://docs.apigee.com/api-platform/troubleshoot/runtime/504-gateway-timeout