@Su Myat Hlaing Thanks for reaching here!
HTTP 504 errors occur when the server is unable to complete a request due to a timeout. This can happen if the server is overloaded or if there is a network issue.
To troubleshoot this issue, you can try the following steps:
- Check the server logs: Check the server logs to see if there are any errors or warnings related to the HTTP 504 errors. This can help you identify the root cause of the issue.
- The major cause for intermittent connection issues is hitting a limit while making new outbound connections- TCP Connections: There's a limit on the number of outbound connections that can be made. The limit on outbound connections is associated with the size of the worker used.
- Go Azure Portal> your web app> click on diagnose and solve problems> click on Availability and performances tile > click on SNAT Failed connection endpoint
- SNAT ports- Go Azure Portal> your web app> click on diagnose and solve problems> click on Availability and performances tile > click on SNAT Port Exhaustion
- You can modify the application to use connection pooling- By default, connections for NodeJS aren't kept alive. Below are the popular databases and packages for connection pooling which contain examples for how to implement them.
- MySQL; MongoDB; PostgreSQL; SQL Server HTTP Keep-alive- agentkeepalive- Node.js v13.9.0 Documentation
- Scale your application: If your application is receiving a lot of traffic, you may need to scale it to handle the load.
For Details suggest you refer this document link-
- Troubleshooting intermittent outbound connection errors in Azure App Service
- SNAT with App Service
- Troubleshoot slow app performance issues in Azure App Service
I hope this helps! Let me know if you have any other questions.