Connection reset by peer on Azure - App Service (Web Application)

D'Amico, Stefano 1 Reputation point
2019-12-04T08:42:01.437+00:00

I have a web application running on an App Service on Azure cloud. On the back-end I'm using a tcp connection to our database (Neo4j graph db), the best practice is to open the tcp connection and keep it alive in order to be more reactive when we perform queries.

The issue I encountered is that the database is logging the exception "Connection reset by peer"; reading on the web I found out that maybe Azure has a TCP timeout configured by default, I read it to be set up to 4 minutes, which could be my issue root cause.

Someone knows how to configure the tcp KEEP ALIVE to always for App Services on Azure? I found on the web how to do it in Google cloud but nothing about Azure cloud.

Thank you in advance.
Stefano

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,900 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 22,401 Reputation points Microsoft Employee
    2019-12-07T17:17:37.963+00:00

    Welcome to Microsoft Q&A. Thanks for posting this question!

    Yes, Azure Load Balancer has a default idle timeout setting of approximately four minutes (230 sec); this is a general idle request timeout that will cause clients to get disconnected after 230 seconds. However, the command will still continue running server-side after that. For a typical scenario, this is generally a reasonable response time limit for a web request. In such scenarios, you could look at async methods to run additional reports. WebJobs or Azure Functions is another option.

    If ‘Always On’ config is not turned On, please do turn it on. The AlwaysOn would help keep the app loaded even when there's no traffic, it will send a request to the ROOT of your application. Whatever file is delivered when a request is made to / is the one which will be warmed up and this feature comes with the App Service Plan is not charged separately.

    You can configure the amount of time the platform will wait before it restarts your container. To do so, set the WEBSITES_CONTAINER_START_TIME_LIMIT app setting to the value you want. The default value is 230 seconds, and the maximum value is 1800 seconds.

     {  
              "name": "WEBSITES_CONTAINER_START_TIME_LIMIT",  
      
              "value": 1800  
     }  
    
    0 comments No comments