Using asynchronous page processing
By default, all page processing in the Phone Participant activity works in synchronous mode. When ASP.NET receives a request for a page, it grabs a thread from a thread pool and assigns that request to the thread. A normal, or synchronous, page holds onto the thread for the duration of the request, preventing the thread from being used to process other requests. If a synchronous request becomes I/O bound (for example, if it calls out to a remote web service or queries a remote database and waits for the call to come back) then the thread assigned to the request cannot process anything else until the call returns. This impedes scalability because the thread pool has a finite number of available threads.
If all request-processing threads are blocked waiting for I/O operations to complete, additional requests are queued and must wait for threads to become available. At best, throughput decreases because requests wait longer to be processed. At worst, the queue fills up and ASP.NET fails subsequent requests with 503 Server Unavailable errors.
Asynchronous page processing
Asynchronous page processing might solve the problems caused by I/O-bound requests. Page processing begins on a thread-pool thread, but that thread is returned to the thread pool once an asynchronous I/O operation begins in response to a signal from ASP.NET. When the operation completes, ASP.NET grabs another thread from the thread pool and finishes processing the request. Scalability increases because thread-pool threads are used more efficiently. Threads that would otherwise be stuck waiting for I/O to complete can now be used to service other requests. The direct beneficiaries are requests that do not perform lengthy I/O operations and can therefore get in and out of the pipeline quickly. Long waits to get into the pipeline have a disproportionately negative impact on the performance of such requests.
Enabling asynchronous page processing
To enable asynchronous page processing, add the InAsyncMode value to the Phone Participants Web.config file so that it reads as follows:
<add key="InAsyncMode" value="true"/>
When InAsyncMode is set to false, page processing occurs synchronously.
See also