Saturday, June 09, 2007

Architects! Design Scalable ASP.NET Solutions

Do you have these issues ?
  • My solution accesses web services and they are fairly slow
  • Overall site usage is very high
  • Simple web requests takes too long to get their responses
The reason for the above issues are the solution is not scaling enough to handle heavy work loads. If you are using web services in your solution the site can easily get bogged down when there is a heavy load accessing the site. The reason for this is the entire ASP.NET thread pool will get busy due to slow web service calls and then all the subsequent requests starts queueing up until threads gets free-ed up. The reason is solution is not scaling in heavy work loads.

One of the simplest design technique is to design asynchronous pages which access third party web services. ASP.NET 2.0 has built in support for implementing Async web pages. You simply have to :

1) Add <%@ Page Async="true" directive in your page
2) Register "Begin event handler" and "End event handler" delegates using AddOnPreRenderCompleteAsync method

Call your web service in Begin event handler and process the web service response in End event handler. Read this for in-depth understanding.

No comments: