views:

49

answers:

1

Hi, I'm wondering about one thing - let's assume that the user clicks a button, and the asynch controller's action is invoked. What happens, when the asynchronous action takes e.g. 10 seconds? The user has to wait 10 seconds to view the result of the action? If so, are the asynch controllers really helpful ?

+4  A: 

Yes. The user will have to wait 10s for his response -- though, if you have a long running action, you'd like want to invoke it via AJAX from a page rendered via another, shorter action.

The value of the asynchronous controller is that it doesn't block other requests on the same thread while the work is being done. Since you only have a limited number of threads, it is possible that they may all end up being blocked on requests to this action. If that happens, then the server cannot serve any requests. Using an asynchronous controller allows the thread to be returned to the thread pool while the asynchronous operation (wait on network or I/O) completes.

See this discussion on MSDN.

tvanfosson