We have REST WebService. It makes request to other server, process result and returns it to user. Is there any benefit to make request to server2 asynchronous?
A:
Making the request asynchronous would allow for better scalability of the service. Asynchronous calls do not block threads, thus the thread can be used elsewhere while your service waits for a response. IIS only has so many threads to work with, so blocking them to wait for a request to come back is typically not a good idea.
aepheus
2010-05-11 15:55:25
+1
A:
Decision of making service calls asynchronous depends upon the need. If the client can do something while the server is processing its request and reply back, the asynchronous service methods are great. At least I have used lot of such service methods. But if the client really need to wait, there is no point for making the call asynchronous.
Kangkan
2010-05-11 15:58:16
@Kangkan that is flawed logic. Regardless of whether the client (or whatever would be 'waiting') has anything else to do, you're better off asynchronous so that other processes can make use of the resources you'd be holding if you had done it synchronously. (especially in this case as we're not talking about a client to server call, this is a server to server call)
aepheus
2010-05-11 18:13:48
@aepheus Thats true. In case of a server to server scenario, again the resource is made free for some other utilisation. This holds good even for a client.
Kangkan
2010-05-13 17:30:49