Random 504 Gateway timeout while doing load test with application gateway

Kenvin 101 Reputation points
2021-07-03T03:22:17.603+00:00

I have 1 application gateway which having 2 backends (Azure VM) which is hosting ASP CORE REST API. And both is using port 80 to communicate.

Everything is working fine with manual test until when we use jmeter to do 2500 Threads POST request load test, some of the request get "504 gateway timeout" as response.

I tried to run the exactly same load test towards the backend straight and didnt received any bad response.

Am i misconfigured something on my application gateway?

Configurations
111484-image.png

HTTP Settings
111420-image.png

Probes
111522-image.png

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
956 questions
0 comments No comments
{count} votes

Accepted answer
  1. Kenvin 101 Reputation points
    2021-07-21T02:39:14.823+00:00

    We modified the settings on backend pools by changing the Target Type from IP Address to Virtual Machine, and the performance get much better afterwards

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. RaviVarmanMSFT 626 Reputation points Microsoft Employee
    2021-07-05T04:51:37.307+00:00

    Hi @Kenvin

    Thanks for reaching us.

    The image attached for http setting is the screen shot of health probe not Http settings.

    Under Http settings check the value of Request time-out (seconds)

    The request timeout is the number of seconds that the application gateway will wait to receive a response from the backend pool before it returns a “connection timed out” error message. If it exceeds the timeout value you see 504 response sent by application gateway to the clients.

    Increase the value of the Request time-out based on your backend response time to avoid 504-connection timed out.

    To verify if the backend is taking time for the response you can enable diagnostic logs on application gateway and you can check access logs for the time taken by backend for the response.

    Access log: You can use this log to view Application Gateway access patterns and analyze important information. This includes the caller's IP, requested URL, response latency, return code, and bytes in and out. An access log is collected every 60 seconds.

    How to enable logging : https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-diagnostics#enable-logging-through-the-azure-portal

    Hope this was helpful. Please let us know in case of any additional questions or concerns.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well

    0 comments No comments