12

Is there any difference in performance ( speed wise ) between a synchronous request and and asynchronous request?

What all are the reasons for using an asynchronous request??

Ajay2707
5,8286 gold badges44 silver badges61 bronze badges
asked Jun 27, 2009 at 9:08
1

3 Answers 3

23

You should mostly always use an asynchronous Ajax Request, in fact I know only about one place where a synchronous Ajax Request should be used which is if you're in an Ajax Request embedding a new JavaScript file on the client and then referencing types and/or objects from that JavaScript file in the return from the original Ajax Request. Then the fetching of this new JS file should (or can sanely) be included through using a synchronous Ajax Request...

Other then that you should always use asynchronous Ajax Requests. The most important reason is that a synchronous Ajax Request makes the UI (browser) unresponsive...

answered Jun 27, 2009 at 9:14
Sign up to request clarification or add additional context in comments.

1 Comment

This question still comes up in search results - the accepted answer is no longer a good one. The proper form is to attach an event to the script being loaded, which is what requirejs does.
1

@Thomas Hansen answer is right but I found a clear explanation with benefits of Asynchronous.

Synchronous is simple, but wait for the server response, thus block the execution of the caller for a period and slower than asynchronous while processing the request.

Asynchronous is required setting, do not wait after submitting the request and immediately return control to the caller, thus faster than Synchronous.

I am coming here when I have to use upload control which has both functionalities in the question and looking the pros and cons of this functionality.

I got the another link which explained with a real example. (the link is the specific tool, so understand the logic)

  • The major difference is the response time from our servers. At the time of upload, synchronous will validate file and create the passcode in real-time. Asynchronous will send the file to our server's queue and deliver notification via email once it is processed.

  • Synchronous is not ideal for multiple, large CSV file since you will need to wait until the file is processed by the server to submit another request. On large files, this also may cause your browsers to return with timeout errors due to the server being too busy. If you have multiple files, asynchronous will allow you to submit multiple files to the server queue to be processed with a email receipt once completed.

https://www.aspsnippets.com/Articles/Difference-between-Synchronous-Sync-and-Asynchronous-Async-Request-Call-in-AJAX.aspx

answered Oct 5, 2018 at 13:43

Comments

-1

there can be serious performance implications caused when it come to highly database intensive applications .. although it's very unlikely to happen .. and sending many Synchronous ajax calls can create a backlog .. so if the application database intensive and sending so many request at once it is better to make it asynchronous. when its set to asynch the browser will fail all unresponsive request and continue with new once..

answered Feb 19, 2014 at 2:08

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.