?
Solved

AJAX Hanging Connections?

Posted on 2007-08-01
8
Medium Priority
?
411 Views
Last Modified: 2008-03-17
Does the following blog article say that if I for example load all of my images from img.mydomain.com instead of mydomain.com, this will open up extra hostname connections to help these hanging connections from being a problem?

http://rdews.com/?p=30
0
Comment
Question by:jls33fsls
  • 3
  • 3
  • 2
8 Comments
 
LVL 16

Expert Comment

by:LeeKowalkowski
ID: 19615683
It does.  Are you constantly requesting lots of images & AJAX simultaneously?

--
Lee
0
 

Author Comment

by:jls33fsls
ID: 19618897
Yes, I have setup a game in AJAX where lots of little images and data is pulled from the server every few seconds.  So doing what this suggests will actually help?
0
 
LVL 1

Expert Comment

by:derelict_debris
ID: 19620890
the article is actually talking about a specific scenario -- splitting your resources across hostnames/servers is a good idea in general, but the symptom described in the article does not directly apply to you.  

this article is talking about when you have a server app that waits until it has something to say to respond, i.e. you make a request for the latest news story, and the server page just hangs and waits until there's a new story and then sends it back to the calling app... while the server page hangs and waits it's using an allocated server HTTP connection, which, if you have hundreds of users opening connections that are simply waiting for the next news story, can cripple your server by overrunning your limit for concurrent connections.

making lots of little requests *will* eventually start clogging up a server, so distributing different bits/types of content across hostnames (and across physical servers if you're that busy) will give a performance increase, but unless you're opening 'wait'-style server scripts, you're probably a long ways off from hitting concurrent connection limits.

HTH - derelict
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 16

Expert Comment

by:LeeKowalkowski
ID: 19620899
Well, it'll increase Internet Explorer's bandwidth, but in turn you'll get more load everywhere else.

Is there any possibility to cache the images at least.  Try to cache or preload everything that doesn't change throughout the course of the game.

--
Lee
0
 

Author Comment

by:jls33fsls
ID: 19622788
Well I currently cache the images, but I make a lot of calls with AJAX and was thinking that things might get hung up if more than one or two went at the same time.  Is this a wrong assumption?
0
 
LVL 16

Assisted Solution

by:LeeKowalkowski
LeeKowalkowski earned 240 total points
ID: 19623359
According to http://support.microsoft.com/kb/183110 your assumption is correct.  IE does this because the HTTP1.1 specification states a client SHOULD NOT maintain more than two persistent connections per server (http://www.rfc.net/rfc2616.html#s8.1.4).

The requests will be queued though, and processed once your connection is idle.  Apparently if you use HTTP1.0 instead of 1.1, IE will use 4 connections.

Concurrent AJAX requests may be tricky to manage anyway, especially at the call-back end if you need to know which response goes with which request.  You might be better off just waiting for the response before firing off more requests, particularly if it's a request for the same data set.

I'm sure you could even come up with something to dynamically throttle the request interval in reaction to response times.

--
Lee
0
 

Author Comment

by:jls33fsls
ID: 19626927
So by adding another hostname it might help this out?
0
 
LVL 1

Accepted Solution

by:
derelict_debris earned 260 total points
ID: 19627977
absolutely.  found this article:

http://ajaxian.com/archives/using-cnames-to-get-around-browser-connection-limits

should give you the info on what/why/how.  basically alias a few hostnames to the same location as the main site, and loop through your available hostnames with each request to allow more than the default 2-connection limit open at any one time.  Google Maps does this.

Also, you may consider consolidating your AJAX calls so you don't need so many concurrent requests -- basically call the server at set intervals with a payload describing all the info you need to retreive, and have the server send back a payload with all the results (either delimited text or xml) for your system to pull out and take the appropriate actions with.  I may be able to help with this if you have some more info on the actual request/response contents.

HTH - derelict
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
Strategic internal linking is often considered an SEO power technique, especially for content marketing. Do you need to hire an SEO agency to optimize you internal linking? No, this article will help you understand the basics of internal linking and…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month17 days, left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question