osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: What makes IE so fast on IIS (invalid TCP/IP
requests...) - msg#00018

List: mozilla.devel.netlib

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

Paste from website:

What makes IE so fast?
Internet Explorer on Windows always seems either to run impossibly fast (page requests are fulfilled almost before the mouse button has returned to its original unclicked position), or ridiculously slow (as with the weird stalling-on-connect problem that many people, including myself, have noticed).

One possible explanation is something that my team and I noticed a couple of years ago, in analyzing packet traces of IE's connection setup procedure. Microsoft might have fixed this since then; I'm not sure. But it's a possible culprit.

First of all, for those rusty on their TCP/IP-- here's how a normal HTTP request over TCP should work:

Client Server
1. SYN ->
2. <- SYN/ACK
3. ACK ->
4. Request ->


This is how the client and server synchronize their sequence numbers, which is how a connection gets established. The client sends a synchronization request, the server acknowledges it and sends a synchronization request of its own, and the client acknowledges that. Only then can the HTTP request proceed reliably.

The server's SYN (synchronize) and ACK (acknowledgement) packets are combined for speed; there's no reason to send two separate packets, when you're trying to get a connection established as quickly as possible. Another speed enhancement that Mac OS 9's stack uses, by the way, is to combine the client's ACK and the HTTP request into a single packet; this is legal, but not frequently done. The idea is that within the structure of TCP/IP, you want to minimize the number of transactions that need to take place in setting up the two-way handshake necessary before you can send the HTTP request.

When tearing down a connection, it looks like this:

Client Server
1. <- FIN
2. ACK ->
3. FIN ->
4. <- ACK


This generally takes four steps, and the FIN/ACK packets are usually not consolidated because connection teardown is nowhere near as speed-sensitive as startup is. (The FIN sequence can be initiated either by the client or the server.)

Many very stupid companies have tried to come up with overly clever ways to speed up TCP/IP. TCP, by its nature, is a stateful and bidirectional protocol that requires all data packets to be acknowledged; this makes the data flow reliable, by providing a mechanism for dropped packets to be retransmitted; but this also makes for a more strictly regimented flow structure involving more packets transmitted over the wire than in simpler, non-reliable protocols like UDP-- and therefore it's slower. One company that thought itself a lot smarter than it really was, called RunTCP, came up with the idea of "pre-acking" TCP packets; it would send out the acknowledgments for a whole pile of data packets in advance, thus freeing them from the onerous necessity of double-checking that each packet actually got there properly. And it worked great, speeding up TCP flows by a significant margin-- in the lab, under ideal test conditions. The minute you put RunTCP's products out onto the real Internet, everything stopped working. Which stands to reason-- their "solution" was to tear out all the infrastructure that made TCP work reliably, under competing load and in adverse conditions, in the first place. Dumbasses.

So then there's this thing we discovered in the lab. We noticed that when you entered a URL in Internet Explorer 5, its sequence of startup packets didn't look like the one shown above. Instead, it looked like this:

Client Server
1. Request ->
Uh... what? Dunno what the hell this is. I'll ignore it, or RST.
2. Oh, you're a standard server. Okay: SYN ->
3. <- SYN/ACK
4. ACK ->
5. Request ->


In other words, instead of sending a SYN packet like every other TCP/IP application in the world, IE would send out the request packet first of all. Just to check. Just in case the HTTP server was, oh, say, a Microsoft IIS server. Because IIS' HTTP teardown sequence looked like this:

Client Server
1. <- FIN
2. ACK ->

...And that's it. The client doesn't FIN, and the server doesn't ACK. In other words, the connection is kept "half-open" on the server end. The reason for this? Why, to make subsequent connections from IE clients faster. If the connection isn't torn down all the way, all IE has to do is send an HTTP request, with no preamble-- and the server will immediately respond. Ingenious!

They probably called it "Microsoft Active Web AccelerationX™®" or something.

(I may be remembering this incorrectly; it might be that the client does FIN, and the server simply keeps the connection around after it ACKs it. Instead of shutting down the connection entirely, it just waits to see if that client will come back, so it can open the connection back up immediately instead of having to go through that whole onerous SYN-SYN/ACK procedure. Damn rules!)

Now, what does this mean for non-IIS servers? It means that if you use IE to connect to them, it first tries to send that initial request packet, without any SYNs-- and then it only proceeds with the standard TCP connection setup procedure if the request packet gets a RST or no response (either of which is a valid way for a legal stack to deal with an unsynchronized packet). But IIS, playing by its own rules, would respond to that packet with an HTTP response right away, without bothering to complete the handshake. So IE to IIS servers will be nice and snappy, especially on subsequent connections after the first one. But IE to non-IIS servers waste a packet at the beginning of each request-- and depending on how the server handles that illegal request, it might immediately RST it, or it might just time out... which would make the browser seem infuriatingly slow to connect to new websites.

This is only marginally less stupid than RunTCP's "solution"-- and I say "marginally" only because in the grand scheme of things, this probably makes sense to Microsoft's network engineers. After all, eventually all clients will be Windows platforms running IE, and all servers will be Windows platforms running IIS. And then we can break all kinds of rules! Rules are only there to hold us back and force us to play nice with other vendors. Well, once the other vendors are all gone, who cares about some stupid RFC?

I have to admire their arrogance and their confidence. But it'll be some time before I can bring myself to admire their technical integrity.

--
Henrik Gemal
Mozilla Evangelist

Get Java working in Mozilla:
http://gemal.dk/mozilla/java.html

Description of profile files:
http://gemal.dk/mozilla/files.html





Thread at a glance:

Previous Message by Date:

Re: Providing channels with a content-type hint

> this does sound like a pretty good solution to me. i'm not happy with > the name of the interface (whatever!)... Yeah, neither am I. It was just a placeholder. > can you enumerate more of the places where you think this will be useful? ;-) Immediate applications: CSS loading XSLT loading Support for <a type="something" href="somewhere"> in the docshell. Plugins (the "type" attribute of the <object> could be used as a hint to the channel loading the plugin, thus improving things with plugins like plugger, which handle multiple MIME types). There may also be applications in other mozilla-based apps (not the browser per se). Not sure about those, to be truthful. ;) Boris -- In the force if Yoda's so strong, construct a sentence with words in the proper order then why can't he?

Next Message by Date:

Re: What makes IE so fast on IIS (invalid TCP/IP requests...)

> Paste from website: So... all the evidence I've seen from people actually testing this with a packet sniffer shows that this is a) a hoax or b) very outdated information. Do you have a packet log that shows otherwise? Boris -- Ninety-Ninety Rule of Project Schedules: The first ninety percent of the task takes ninety percent of the time, and the last ten percent takes the other ninety percent.

Previous Message by Thread:

十年

您想成為一位將來年薪百萬的人嗎 以下的資訊將讓您的人生有重大的轉變 如果您不看就錯失一個大好良機了 如果有一個老闆願意不在乎你的學經歷,上下班正不正常,有無貢獻度,都給你起薪35000元!每年還幫你加薪10%!!你會得到什麼人生!? 第一年 35000 ×12 =420000 (年薪)第二年 420000 ×1.1(加薪10﹪)= 46.2萬第三年 46.2 ×1.1 = 50.82萬第四年 50.82 ×1.1 = 55.902萬第五年 55.902 × 1.1 = 61.4922萬第六年 61.4922 × 1.1 =67.64萬第七年 67.64 ×1.1 = 74.40萬第八年 74.40 ×1.1 = 81.84萬第九年 84.84 ×1.1 = 90.03萬第十年 90.03 ×1.1 = 99.03萬 十年得到收入 670 萬;老闆再送你退休金 100 萬 以上合計十年共賺得770萬 花費600萬購屋,花費70萬買一部ALTIS代步-共花費670萬! 剩餘的100萬不是你存簿裡的錢!是這十年所有的生活費!! 100萬 / 10年 / 12月=8333元  重點是-有這種老闆嗎??所以以上所有數據不過是"夢想"罷了@@~  如果連每個月8333元的生活品質都是夢想那麼做好生涯規劃就非常的重要!! 想了解更多嗎? 線上影片播放(18分鐘)

Next Message by Thread:

Re: What makes IE so fast on IIS (invalid TCP/IP requests...)

> Paste from website: So... all the evidence I've seen from people actually testing this with a packet sniffer shows that this is a) a hoax or b) very outdated information. Do you have a packet log that shows otherwise? Boris -- Ninety-Ninety Rule of Project Schedules: The first ninety percent of the task takes ninety percent of the time, and the last ten percent takes the other ninety percent.
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!