Q.1 I know that when we are talking about synchronous HTTP
, for each request a Thread may be spawn and get blocked, so when number of simultaneous connections increase, we will encounter massive thread overhead.
Asynchronous mode will tolerate some overhead polling responses for something desired, but number of Threads drastically decrease.
I also know that Asynchronous HTTP
will let us take actions even when response delivered is not the complete response (only a part of response is recieved) which is appropriate for real-time actions.
But what are other benefits of Async HTTP
?
Q.2 I have a server which has only and only one client, but that client will send thousands of requests per second. I use blocking IO (Synchronous HTTP
) with lightweight Threads (Quasar
). Should I switch to Async? What is the benefit of doing that for me?
First, I don't think we talk about "asynchronous HTTP" because of ambiguous meaning.
There're 2 cases when we mention both asynchronous and http:
I think your question is actually about the latter.
A.1 Benefits of asynchronous I/O
A.2 You could switch if your scenario matches either of above.