473,375 Members | 1,556 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,375 software developers and data experts.

AJAX simultaneous requests getting queued up

Hello all,

I'm experiencing a problem with ASP.Net for which I can't find a
reasonable explanation, or any information.
I'm currently developing an application that, through AJAX, asks the
server for updated information to show, and can also send information
to the server.
To do this, I have an XMLHttpRequest that queries an Asynchronous HTTP
Handler (implementing IHttpAsyncHandler), which does not reply until
there is actual information, or a time passes (30 seconds).
In order to send information to the server, I open a second
XMLHttpRequest and POST to another HTTP handler (this one is
synchronous).

Now, for this to work, both requests have to be simultaneous,
obviously, but what i'm getting is that the second request (the one
that POSTs) waits until the first one returns before sending, which
makes the app completely unresponsive.
Since I could think of a million things that could be going wrong here
(like the Asynchronous handler doing something weird), I created a
very simple test scenario to isolate the problem:

1) I created two synchronous (regular) HTTP handlers, that simply wait
for 5 seconds, and then reply with "OK-1" or "OK-2" (depending on
which one was queried).
2) In case I was forgetting something non-obvious (like implementing
some interface), I also tried creating these two as Pages, instead of
HTTP handlers, and I got exactly the same results.
3) I created a page which onLoad starts an XMLHttpRequest GET to the
first handler, and once it's finished, it calls the same function
again, creating a loop, which successfully outputs "OK-1" every 5
seconds.
4) I added a button that starts another XMLHttpRequest GET to the
second handler, only once (no loop)

This is where the problem lies. When I press the button, it seems like
requests are queued up. Once the first request comes back, after 5
seconds the second comes back, and then after another 5 seconds the
first one comes back again.

To make sure the problem wasn't on the client, I tried this with both
Firefox and IE, and I used 3 different ways of doing the Ajax call
(Prototype, AJAXRequest, and manually). I also tried both from
localhost, and from another computer in my network. All gave me the
same results.

Finally, if I implemented the 2 handlers on PHP (sorry for the
blasphemy), this worked exactly as expected, so this must be something
on the server, not on the client.

Also, it's not something about "the server not responding
simultaneously to two request from the same client" (which it
shouldn't anyway), since if I open 2 browser windows, the "loops" in
both work perfectly and simultaneously.

What I don't get is what difference there is between doing the two
requests from the same machine, and doing them from the same browser
window. Like I said, it works with PHP on the server, so i'm not
hitting the 2-connection limit on the client.

I'm seriously stumped on this one (and quite desperate, to be honest),
since if I can't fix this, the workaroung is looking PRETTY ugly
(aborting the pending request, creating the POST, then resuming the
loop, yuck...)

I assume this is some feature hiding somewhere inside ??.config, but i
can't find anything (i tried mindless things like setting debug=false,
trace=false, and other desperate attempts with no luck)

Any help, or pointers will be GREATLY appreciated!

Thanks in advance
Daniel Magliola

Jan 29 '07 #1
2 3806
With ASP.NET (as well as with old ASP)
requests for the same session are queued up. Meaning that second will not
execute until first one is done.
so probably it's not problem with AJAX, you just need to specify that pages
you return information with are Session-less (or HttpHandlers in your case).
George

<dm*******@gmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
Hello all,

I'm experiencing a problem with ASP.Net for which I can't find a
reasonable explanation, or any information.
I'm currently developing an application that, through AJAX, asks the
server for updated information to show, and can also send information
to the server.
To do this, I have an XMLHttpRequest that queries an Asynchronous HTTP
Handler (implementing IHttpAsyncHandler), which does not reply until
there is actual information, or a time passes (30 seconds).
In order to send information to the server, I open a second
XMLHttpRequest and POST to another HTTP handler (this one is
synchronous).

Now, for this to work, both requests have to be simultaneous,
obviously, but what i'm getting is that the second request (the one
that POSTs) waits until the first one returns before sending, which
makes the app completely unresponsive.
Since I could think of a million things that could be going wrong here
(like the Asynchronous handler doing something weird), I created a
very simple test scenario to isolate the problem:

1) I created two synchronous (regular) HTTP handlers, that simply wait
for 5 seconds, and then reply with "OK-1" or "OK-2" (depending on
which one was queried).
2) In case I was forgetting something non-obvious (like implementing
some interface), I also tried creating these two as Pages, instead of
HTTP handlers, and I got exactly the same results.
3) I created a page which onLoad starts an XMLHttpRequest GET to the
first handler, and once it's finished, it calls the same function
again, creating a loop, which successfully outputs "OK-1" every 5
seconds.
4) I added a button that starts another XMLHttpRequest GET to the
second handler, only once (no loop)

This is where the problem lies. When I press the button, it seems like
requests are queued up. Once the first request comes back, after 5
seconds the second comes back, and then after another 5 seconds the
first one comes back again.

To make sure the problem wasn't on the client, I tried this with both
Firefox and IE, and I used 3 different ways of doing the Ajax call
(Prototype, AJAXRequest, and manually). I also tried both from
localhost, and from another computer in my network. All gave me the
same results.

Finally, if I implemented the 2 handlers on PHP (sorry for the
blasphemy), this worked exactly as expected, so this must be something
on the server, not on the client.

Also, it's not something about "the server not responding
simultaneously to two request from the same client" (which it
shouldn't anyway), since if I open 2 browser windows, the "loops" in
both work perfectly and simultaneously.

What I don't get is what difference there is between doing the two
requests from the same machine, and doing them from the same browser
window. Like I said, it works with PHP on the server, so i'm not
hitting the 2-connection limit on the client.

I'm seriously stumped on this one (and quite desperate, to be honest),
since if I can't fix this, the workaroung is looking PRETTY ugly
(aborting the pending request, creating the POST, then resuming the
loop, yuck...)

I assume this is some feature hiding somewhere inside ??.config, but i
can't find anything (i tried mindless things like setting debug=false,
trace=false, and other desperate attempts with no luck)

Any help, or pointers will be GREATLY appreciated!

Thanks in advance
Daniel Magliola

Jan 29 '07 #2
George,

Thank you for your resopnse.
I actually found the solution, and it was close to what you are saying
(I wish google groups would've let me know that you answered)

I was already implementing HttpHandlers, but they were not session-
less. In fact, i DO need sessions.
What I ended up doing was implementing IReadonlySessionState in these,
so they could access session but wouldn't be blocking it.

Thanks again for the help!

Daniel Magliola

Feb 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: slugger | last post by:
Hope this is not OT: I am running into some strange things whenever my ASP pages send out simultaneous requests to another ASP page which in turn gains access to a MySQL database using a DSNless...
1
by: googlegroups | last post by:
Hello everyone, I need a new web server for our existing website and I don't want subscribe to the whole IIS way of doing things. I thought I would implement a custom web server using the new...
3
by: Tony | last post by:
I've done a fair bit of searching on this, but I want to be certain about what I've found - so here goes with a long example and three questions: For clarity, let me give an example (a number of...
5
by: cmercier | last post by:
Hi everyone! I am using the Prototype library and ran into a serious limitation. I need to make many concurrent AJAX calls to the server, but Prototype is queueing them instead. Obviously,...
3
by: SimonPlatten | last post by:
Hi, I'm a software engineer working in the offshore industry, I've been coding in various languages professionally since 1987. In my present employment I am working with control systems in the...
13
by: Marvin Zhang | last post by:
Hi, I'm not familiar with web programming, but I have a problem here. I have a page. When a user click one button on it, I will use AJAX to request a PHP script which will do a bunch of tasks,...
17
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
2
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I'm using an async page to kick off a couple of asynchronous web services using the PageAsyncTask class. I'm also testing a progress bar that uses an Ajax UpdatePanel and Timer control to...
6
by: Bart Van der Donck | last post by:
Hello, I'm presenting my new library 'AJAX Cross Domain' - a javascript extension that allows to perform cross-domain AJAX requests. http://www.ajax-cross-domain.com/ Any comments or...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.