question

AntonyMaxwin-4065 avatar image
0 Votes"
AntonyMaxwin-4065 asked BruceZhang-MSFT answered

Maximum connection limit in .net frame work 4.7

HI
I have 2 web server, one DB server. and we are running heavy application like Building plan approval system.
in this we need to upload autocad files, and other images, pdf files. and these are stored in SQL 2014 standard edition. we are using iis 7 webserver. and the framework is 4.7 Servers are running with Enough ram and CPU,
What is the maximum concurrent connections that we can have in this frame work..
currently we are getting a maximum of 500 connections without any issue, but when it reach beyond 550 then the application became slow (Considering only one web server).

what are the specification that we need to handle 4000 to 5000 connections.


Thanks

sql-server-generalwindows-server-iisdotnet-standarddotnet-entity-framework-core
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BruceZhang-MSFT avatar image
0 Votes"
BruceZhang-MSFT answered

Hi @AntonyMaxwin-4065 ,

In advanced setting of site, IIS allows you set maximum concurrent connections.
139568-3.jpg

And in advanced setting of app pool, it allows you set worker processes(w3wp.exe) of app pool.
139619-4.jpg

That means each application pool will start one worker process to handle requests by default, and the application which hosts on application pool supports 4294967295 concurrent connections. However, the 4294967295 does not mean that the application can really receive and process so many concurrent requests. It actually represents that http.sys can pass so many concurrent requests to other modules of IIS and asp.net routing. The number of concurrent requests that an Asp.net application can handle is also affected by the asp.net itself.

If you check the machine.config in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config and search <processModel>, you will find an item like this:
139691-5.jpg

This means that the .net framework will automatically configure the asp.net thread parameters for you to handle concurrent requests according to different situations. The current working thread of .net defaults to “12*CPU” (autoconfig=”true”), so if IIS has two CPUs, there will be 24 working threads.

The 500 connections you see just the number of IIS and application can create successful connection with client and won't affect the performance of server, not the number of concurrent requests that asp.net can handle at the same time. With more than 500 concurrent requests, the server needs to allocate performance to maintain connections with clients and maintain their queues. This affects the performance assigned to the worker process (w3wp.exe) and slows down application processing.



If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.


Best regards,
Bruce Zhang



3.jpg (86.0 KiB)
4.jpg (63.5 KiB)
5.jpg (57.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

the connection limit is probably not the issue. Its settable in IIS but the default is pretty high.

You need to run performance tests, then determine what resource you are running out of (memory, cpu, threads, i/o, network, GC, sql queries, etc). fix the resource limit, then run again. fix the next resource limit.

your initial testing shows you start to resource limits at 550 requests. You need to determine what the limit is.

to get an order of magnitude performance increase, you will probably need to modify your code. as you want to limit the number of threads and improve concurrency, be sure all your code is async. also don't buffer any of the uploads or downloads of large files. again use streaming to read/write to sqlserver.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.