MaxConnections in Azure Web App?

16,371

Solution 1

First thing to check: are you using static HttpClient? If not, I would fix that first, then re-run your load test.

Long story short, you shouldn't need to modify the maxconnection settings. The max is set by the version of .NET and it is a very, very high number. If you suspect you are running out of sockets, you should do a load test and measure number of SocketExceptions.

Since we're in the topic of resource constraints, are you also using async calls. Specifically, async in your WebAPI controller down to every dependency in your codebase.

private static HttpClient Client = new HttpClient();

As a best practice, you should consider using HttpClientFactory to handle managing the lifetime of HttpClient instances as described in https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests.

Solution 2

The load test result does not stand for the http request number limit of the web app, it just indicates load test tool simulates these requests per second. The test result could be affected by concurrent customer number, App Service plan tier, instance count and URLs etc.

Here is a test result (web app with S1 app service plan, 250 concurrent customers, URL point to a static html page)

enter image description here

CPU and Memory usage

enter image description here

From above screenshots, we could find that it just uses a little of CPU and memory resource during the time we do the load test. And the result 226.49 req/sec is not the actual max number of request that web app could handle.

Besides, if App Service plan you are using now could not meet your app requirement, please try to scale your App Service plan.

Share:
16,371
user1142433
Author by

user1142433

Updated on June 11, 2022

Comments

  • user1142433
    user1142433 almost 2 years

    I have an Azure Web App that I suspect is running into a max connection limit (i.e. maximum number of HTTP requests that can be active at the same time).

    1. How does one modify the maximum number of simultaneous web requests in an Azure Web Application?

    2. Is there a way to monitor connection queues in Azure?

  • Simon Ordo
    Simon Ordo over 7 years
    I understand that the user load reported in the performance is the actual number of users connected. However, if the CPu and RAM looks good and things improve when I add more instances, I deduced that there is a connection limit being hit.