Active time for HTTP connection

C

campos

Hi,

I am trying to use Ajax to connect with an HTTP server and do some
interactions. The first HTTP request will be longer than others due to
the 3-way hand shake. So I'd like to reuse that TCP channel to avoid
connect again. I wonder the active time for javascript to keep that
HTTP connection alive, so that I could make use of that time to
optimize each connection. Thanks in advance.
 
T

Thomas 'PointedEars' Lahn

campos said:
I am trying to use Ajax to connect with an HTTP server and do some
interactions. The first HTTP request will be longer than others due to
the 3-way hand shake.

(You are referring to
<please continue the
thread next time.)

You got it all wrong. It is not the TCP handshake to establish the
connection that *can* make the first transmission slower.
So I'd like to reuse that TCP channel to avoid connect again.

"TCP channel"? Are you sure you know what you are doing?
I wonder the active time for javascript to keep that
HTTP connection alive,

There is none as "javascript" does not do that; the HTTP client does, caused
by an implementation of the IXMLHTTPRequest interface that is only used
*through* an ECMAScript implementation (such as JavaScript or JScript), if that.
so that I could make use of that time to optimize each connection.
Thanks in advance.

Persistent HTTP connections are maintained server-side. There has to be an
HTTP/1.1-capable server that needs to support that. And if the server
supports it, the next message has to be sent before the server-defined wait
time runs out.

http://httpd.apache.org/docs/1.3/keepalive.html
http://tools.ietf.org/html/rfc2068#section-8.1


PointedEars
 
V

VK

Hi,

I am trying to use Ajax to connect with an HTTP server and do some
interactions. The first HTTP request will be longer than others due to
the 3-way hand shake. So I'd like to reuse that TCP channel to avoid
connect again. I wonder the active time for javascript to keep that
HTTP connection alive, so that I could make use of that time to
optimize each connection.

As it was pointed out, JavaScript doesn't handle HTTP transmissions,
it is a system-level feature.

For IE / Windows with default registry settings, on Keep-Alive the TCP/
IP socked gets freed after 60sec (1 min) of inactivity. For an
intranet solution you may set bigger KeepAliveTimeout for all involved
machines in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion
\InternetSettings

For the Internet one of workarounds would be to make a "slow page"
over script, so dripping the response by small chunks every say 5sec
until the data is ready - then flush the rest of the page. Can be very
irritating though for end-users.
 
V

VK

For IE / Windows with default registry settings, on Keep-Alive the TCP/
IP socked gets freed after 60sec (1 min) of inactivity. For an
intranet solution you may set bigger KeepAliveTimeout for all involved
machines in HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion
\InternetSettings

I have found this KB article that covers the matter more fully:

http://support.microsoft.com/kb/813827
 
C

campos

(You are referring to
<continue the
thread next time.)

You got it all wrong. It is not the TCP handshake to establish the
connection that *can* make the first transmission slower.

Well, then what makes the first transmission longer? I'm thinking that
it takes another RTT to establish the connection for the first HTTP
request. In my situation, RTT is about 170ms, which is negligible.
 
T

Thomas 'PointedEars' Lahn

campos said:
Well, then what makes the first transmission longer? I'm thinking that
it takes another RTT to establish the connection for the first HTTP
request. In my situation, RTT is about 170ms, which is negligible.

The bandwidth allocated for you by statistical multiplexing is shaped
according to your previous network usage. If, and only if, that feature is
implemented along your network path, the first connection is significantly
slower because you have not used that path as much before. That has nothing
to do with the time the TCP handshake takes to establish one connection.

Please trim your quotes:
http://www.jibbering.com/faq/faq_notes/clj_posts.html


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,979
Messages
2,570,185
Members
46,725
Latest member
LeonidaTul

Latest Threads

Top