Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify if IE exhausted it's per domain connection limits

If IE is busy with page loading then it generally shows swirling icon instead of favicon.ico. But how to distinguish between following

  1. Connection limits are reached and IE has not yet received all content
  2. IE received response from all its requests but is busy rendering the page

Will IE a show busy icon if any JavaScript operation is not finished (mainly onload JavaScript call ?)

Thanks and regards, Avinash

like image 353
avinash Avatar asked Dec 06 '10 00:12

avinash


People also ask

How many connections can a single port handle?

Ports are 16-bit numbers, therefore the maximum number of connections any given client can have to any given host port is 64K.

How many connections can one server handle?

Then theoretical limit a server can support on a single port is 248 which is about 1 quadrillion because: The server distinguishes the connections from clients' source IPs and the source ports. [number of source IP addresses]x[num of source ports] 32 bits for the address and 16 bits for the port.


1 Answers

In regards to "1.Connection limits are reached and IE has not yet received all content" this limitation is imposed in WinInet, I didn't even try to answer this question because almost all the ways I could think to even approach the problem(from within the page itself) involved methods that would further reduce the load time of the page. DanP's suggestion about Fiddler is a good one, what you could do is write an extension or some custom script for Fiddler that would log when TWO requests to the same host name were processing at any given time so you would have a log. Otherwise it's a matter of eye-balling it in fiddler and just looking to see if two requests of the same host name are processing at the same time, but in general the requests finish so quickly that trying to get a good feel of this in fiddler by just watching the UI can be problematic.

In regards to "2.IE received response from all its requests but is busy rendering the page" it sounds like you want to know when the page is ready for the user to interact with it. The fact of the matter is IE doesn't perform these tasks synchronously, it renders the page while it is downloading things, and the user can interact with the page while IE is still busy downloading. So what I've done is included an example here that shows how you can tell when that spinner icon in the Internet Explorer tab switches to the favicon. The spinner goes away when document.readyState == "complete", however the page is ready for the user to interact with it on document.readyState == "interactive" which happens to also be after the document.body.readyState == "complete", I don't know if document.body.readyState == " complete" is causative of document.readyState == "interactive" but they certainly appear to coincide. However, if you did want to determine if everything was downloaded, every element in the DOM has a readyState property, you could potentially enumerate the DOM to check if every element has a readyState == "complete" to determine if every element was done downloading and rendering.

The sample html you can save to your computer and run, but if you run it from the local disk, IE will prompt you with the yello info bar, and you will need to right click to allow it to run the script. When the html is run properly you should see javascript alerts, you will notice on the alert that says "document.readyState: interactive" that the spinner is still spinning, but when the alert that says "document.readyState: complete" you will notice the spinner icon has gone away. Hope this helps.

<html>
<head>
    <script language="javascript">
        document.onreadystatechange = function(e)
        {
            alert("Document State: " + 
                             document.readyState + 
                             "\nBody State: " + 
                             document.body.readyState);
        };
    </script>
</head>
<body>
Test Content
<div id="placeToAddTo"></div>
<script language="javascript" type="text/javascript">
    for(var i = 0; i < 1000; i++)
    {
        var obj = document.createElement("div");
        obj.innerText = "Div Number: " + i + " Document State: " 
                   + document.readyState + " Body State: " 
                   + document.body.readyState;
        document.getElementById("placeToAddTo").appendChild(obj);
    }
    alert("completed creating object");
</script>
</body>
</html>
like image 133
Mark At Ramp51 Avatar answered Sep 26 '22 11:09

Mark At Ramp51