I am a little bit new to ASP.NET MVC, after searching I still have one thing don't understand. Why async controller needed? Since every HTTP request will cause the sever to create a new instance of controller, so the server doesn't block any request, then why need an async controller?
Asked
Active
Viewed 125 times
0
-
Chances are unless you're dealing with a server that gets a lot of requests (like SO) you won't see too much benefit to its blocking prevention. – Brad Christie Nov 08 '12 at 13:42
-
Thank you for pointing out this, what should I do with this, delete it? – Shuping Nov 08 '12 at 14:00
-
You can close to vote your own question too. – Marijn Mar 05 '14 at 12:08
1 Answers
0
The whole point of Async Controllers is to free the IIS threads while long operations are performed. IIS threads are pulled from the .NET thread pool. The maximum number of thread pool threads will vary depeding on your system configuration (on my core-2-quad it's 1023). That means that long operations will consume one of these threads. When the maximum number is reached, additional requests may have to wait until one is freed. To put it very clearly: If you have 1023 actions executing long polling requests, your web-site will stop responding to additional requests.
When you use Async Controllers, you can create threads outside the thread pool and, thus, going around this max threads limit.

Andre Pena
- 56,650
- 48
- 196
- 243