Sometimes, there are HTTP 504 errors in the web app on a Linux server (not always)

Su Myat Hlaing 180 Reputation points
2023-11-09T01:49:48.73+00:00

Sometimes, there are HTTP 504 errors in the web app on a Linux server (not always). how to solve, please?

Node.js web app.

User's image

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2023-11-09T06:21:11.55+00:00

    @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:

    1. 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.
    2. 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.
    3. Go Azure Portal> your web app> click on diagnose and solve problems> click on Availability and performances tile > click on SNAT Failed connection endpoint
    4. 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
    5. 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.
    6.  MySQL; MongoDB; PostgreSQL; SQL Server HTTP Keep-alive- agentkeepalive- Node.js v13.9.0 Documentation
    7. 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-

    I hope this helps! Let me know if you have any other questions.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.