Reputation: 3070
I have a web application with web layer is a ASP.NET MVC 3 web application, service layer is WCF, database is MSSQL
In this article: http://blogs.msdn.com/b/tmarq/archive/2010/04/14/performing-asynchronous-work-or-tasks-in-asp-net-applications.aspx , it mentioned that I should do asynchronous processing "when the benefit of switching threads out weights the cost of the context switch.", "For example, if you make an asynchronous web service request to a remote server"
Does that mean, in every request, I should try as much as I can to use asynchronous processing (in ASP.NET MVC I assume it's asynchronous controller instead of PageAsyncTask as in ASP.NET, correct me if I'm wrong) whenever there's a call to WCF service (or if I don't use WCF service, then whenever I have a call to database) to increase the throughput of server, increase number of requests that server can process at one time?
Another question which is a bit related: does anyone know or can point me to an article that explains about connection limit when connecting to WCF from web layer like this? I heard that the limit is 5 concurrent connections at a time for WCF but cannot confirm. If it's 5 concurrent connections, it means the bottleneck is in WCF even if I increase throughput of web layer?
Thank you very much
Upvotes: 0
Views: 191
Reputation: 1038930
Does that mean, in every request, I should try as much as I can to use asynchronous processing
There's a benefit for doing this only if you have I/O operations (remote HTTP call such as a WCF service call, database call, ...). But you should do that only after you perform extensive load tests and have determined that synchronous calls are a bottleneck for your application in case you have such high processing requirements. In most cases the complexity of the asynchronous code and the risks of making very hard to find bugs outweigh the benefits.
does anyone know or can point me to an article that explains about connection limit when connecting to WCF from web layer like this?
I am not aware of the existence of such limit.
Upvotes: 2