What is the difference between asynchronous and synchronous HTTP request?
WebserverWebserver Problem Overview
What is the difference between asynchronous and synchronous HTTP request?
Webserver Solutions
Solution 1 - Webserver
Synchronous: A synchronous request blocks the client until operation completes. In such case, javascript engine of the browser is blocked.
Asynchronous An asynchronous request doesn’t block the client i.e. browser is responsive. At that time, user can perform another operations also. In such case, javascript engine of the browser is not blocked.
Solution 2 - Webserver
Check out https://stackoverflow.com/questions/5971301/determining-synchronous-vs-asynchronous-in-web-applications for previous discussion. In short:
> Asynchronous APIs do not block. Every synchronous call waits and blocks for your results to > come back. This is just a sleeping thread and wasted computation.
Solution 3 - Webserver
Sachin Gandhwani's answer is very well explained in simple words. In case you are still not convinced with the difference of asynchronous HTTP request and synchronous HTTP request, you can read this - https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests
Solution 4 - Webserver
Asynchronous APIs do not block. Every synchronous call waits and blocks for your results to come back. This is just a sleeping thread and wasted computation.
If you need something to happen, send an asynchronous request and do further computation when the request returns. This means your thread sits idle and can pick up other work.
Asynchronous requests is the way to scale to thousands of concurrent users.