Active time for HTTP connection

Discussion in 'Javascript' started by campos, Nov 16, 2007.

  1. campos

    campos Guest

    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.
    campos, Nov 16, 2007
    #1
    1. Advertising

  2. campos wrote:
    > 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
    <news:mcD_i.10026$>; 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
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
    Thomas 'PointedEars' Lahn, Nov 16, 2007
    #2
    1. Advertising

  3. campos

    VK Guest

    On Nov 16, 4:23 am, campos <> wrote:
    > 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.
    VK, Nov 17, 2007
    #3
  4. campos

    VK Guest

    On Nov 17, 3:39 pm, VK <> wrote:
    > 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
    VK, Nov 17, 2007
    #4
  5. campos

    campos Guest

    On Nov 16, 11:37 pm, Thomas 'PointedEars' Lahn <>
    wrote:
    > campos wrote:
    > > 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
    > <news:mcD_i.10026$>;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.


    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.

    >
    > > 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.htmlhttp://tools.ietf.org/html/rfc2068#section-8.1
    >
    > PointedEars
    > --
    > realism: HTML 4.01 Strict
    > evangelism: XHTML 1.0 Strict
    > madness: XHTML 1.1 as application/xhtml+xml
    > -- Bjoern Hoehrmann
    campos, Nov 18, 2007
    #5
  6. campos wrote:
    > On Nov 16, 11:37 pm, Thomas 'PointedEars' Lahn <>
    > wrote:
    >> campos wrote:
    >>> 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
    >> <news:mcD_i.10026$>;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.

    >
    > 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
    --
    "Use any version of Microsoft Frontpage to create your site. (This won't
    prevent people from viewing your source, but no one will want to steal it.)"
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
    Thomas 'PointedEars' Lahn, Nov 18, 2007
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    4,774
    Tor Iver Wilhelmsen
    Aug 29, 2005
  2. Replies:
    0
    Views:
    549
  3. flamesrock
    Replies:
    8
    Views:
    434
    Hendrik van Rooyen
    Nov 24, 2006
  4. lkcl
    Replies:
    6
    Views:
    1,017
  5. Replies:
    1
    Views:
    130
    Tom Cole
    Sep 17, 2006
Loading...

Share This Page