What is the difference between asynchronous and synchronous HTTP request?

前端 未结 4 1782
礼貌的吻别
礼貌的吻别 2020-12-04 14:22

What is the difference between asynchronous and synchronous HTTP request?

4条回答
  •  盖世英雄少女心
    2020-12-04 14:55

    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.

提交回复
热议问题