interview questions are asked what makes concurrent requests? Isn"t the request asynchronous? If there are too many requests, it will naturally occur concurrently. What does this mean?
interview questions are asked what makes concurrent requests? Isn"t the request asynchronous? If there are too many requests, it will naturally occur concurrently. What does this mean?
to put it simply, you can't understand
in this way. asynchronism is generally aimed at the single-threaded model. due to the bottleneck caused by the long task link, the task is split and the task time is shortened , which is completed by two or more threads, but it is still a task. It generally uses some middleware, such as kafka
A simple example is concurrency and asynchronism are not related concepts. If you want to initiate two asynchronous requests at the same time, they must be initiated concurrently. If you put the second in the first callback, it will be serial. If you use await in ESnext, you need to use promise.all to achieve concurrency, because await waits for the end of the first request before moving on to the next one. Previous: Why do too many requests overwhelm the server? Next: How can H5+API Reference, like Yuansheng, detect WIFI signals but do not have a network? ajax
when async=false
, it is a single-thread serial task. Due to the existence of network io, the current thread will be suspended and blocked.
when async=true
, the task is split. Immediately after sending the http, the thread returns and executes the next task. After requesting the return value, another thread calls callback
, which backfills the result
http2
and uses a more complex multiplexing technology to improve the overall performance. For more information, please see
is purely a personal opinion.
use