digitalhunter
digitalhunter

Reputation: 1

Ajax requests are served by a single server thread?

I made a simple ajax framework at http://www.iqp.vn and I allow users to make many ajax requests or cancel them.

But from testing I see that, when user make an ajax request that do some thing that takes up a long time like copying/writting a large text file, subsequent requests will wait until the first one is done before them are executed. On the client I see that the second request although it performes very quick processing always return after the 1st "big" request is done.

I also use hidden form (iframe) submission to allow user to upload files in ajax style, and when user upload a large file, and cancel the request (== reset the iframe on the client), and click to generate another request, I see that the later request always wait for the first upload request to finish.

Can any one help me with this please, I thought using ajax, and (if possible) with multithreaded processing on server, I can get some very nice effects on client.

Upvotes: 0

Views: 159

Answers (2)

Quang Vo
Quang Vo

Reputation: 492

Ajax requests are treated like normal requests. You should check:

  • Is a ajax call waiting for the other to finish before calling (client side)?
  • Do you implement any locking mechanism on the server?
  • May be all the threads in the thread pool are busy with other requests

Just for reference, this jQuery plugin can upload many files simultaneously: http://aquantum-demo.appspot.com/file-upload

Upvotes: 2

Andrew Cooper
Andrew Cooper

Reputation: 32596

This behaviour will depend on the configuration of your web server. If you've only got one thread assigned to the application pool then that thread will be servicing every request.

Upvotes: 0

Related Questions