Context: From my javascript web interface, I run a lengthy (several minutes) operation that runs on the .NET2.0 backend. The call is immediately returned with the identifier of the operation when long work is performed in parallel. Operations do not require heavy CPU utilization, but perform slow network calls. As soon as the operation is completed, I want to see the results in the web interface.
Question: How can I notify the client when the work is done?
Parameters that I reviewed:
Option 1: I start a long operation asynchronously directly from JS, and I expect the return value to be endresult instead of the operation identifier. My AJAX library takes care of everything, and life looks very easy and neat. The problem is that on the server side, the thread is a ThreadPool thread, which I now blocked for several minutes . You do not need too many lengthy parallel requests to make ThreadPool starve and bring the entire server to its knees, even if there is sufficient processing power.
Option 2: with the operation ID, I start polling the server if the operation is completed. However, this is a denial of service attack on my own server. In addition, there must be a fair ajax solution. This is not a unique issue.
source share