Sunday, February 04, 2007

Avoid Blocking on Long-Running Tasks

Extract from: Scale Net

Avoid Blocking on Long-Running Tasks

If you run long-running or blocking operations, consider using the following
asynchronous mechanisms to free the Web server to process other incoming requests:
● Use asynchronous calls to invoke Web services or remote objects when there is an
opportunity to perform additional parallel processing while the Web service call
proceeds. Where possible, avoid synchronous (blocking) calls to Web services
because outgoing Web service calls are made by using threads from the ASP.NET
thread pool. Blocking calls reduce the number of available threads for processing
other incoming requests.
For more information, see “Avoid Asynchronous Calls Unless You Have
Additional Parallel Work” later in this chapter.
● Consider using the OneWay attribute on Web methods or remote object methods
if you do not need a response. This “fire and forget” model allows the Web server
to make the call and continue processing immediately. This choice may be an
appropriate design choice for some scenarios.
● Queue work, and then poll for completion from the client. This permits the Web
server to invoke code and then let the Web client poll the server to confirm that
the work is complete.
More Information
For more information about how to implement these mechanisms, see “Threading
Guidelines” later in this chapter.

No comments:

Shared Cache - .Net Caching made easy

All information about Shared Cache is available here: Its free and easy to use, we provide all sources at codeplex.

Facebook Badge