Re: how pipeline works

Richard Atterer <[email protected]>
Newsgroups gmane.comp.lib.libwww
Message-ID <[email protected]>
On Fri, Sep 05, 2003 at 10:49:26AM -0700, Jerry G. Chiuan wrote:
> - By using pipeline, does client need only one TCP connection? ( all
> requests go through the same connection )

Yes!

> - If yes, how does it guatantee the sequence of consecutive responses? e.g.
> server takes longer time to deal with 1st request, but shorter time for 2nd
> request. The server would hold 2nd response until 1st response is generated
> then send them both sequentially back to client, or the server just sends
> back directly no matter which response is ready

The server will need to maintain a queue of pending requests. Any new 
requests get added to the end of the queue, and whenever a file has been 
sent out, the next request is taken from the front of the queue.

RFC 2068 (HTTP/1.1) says the following:

8.1.2.2 Pipelining

   A client that supports persistent connections MAY "pipeline" its
   requests (i.e., send multiple requests without waiting for each
   response). A server MUST send its responses to those requests in the
   same order that the requests were received.

> - for doing that, we at least need 2 threads, one is for sending requests,
> another is for receiving reponses, don't we?

That's one way to implement it - I guess it would also be enough if the
server checked for new requests at regular intervals, e.g. after every x kB
of sent data. I have no idea how Apache implements it.

Cheers,

  Richard

-- 
  __   _
  |_) /|  Richard Atterer     |  GnuPG key:
  | \/¯|  http://atterer.net  |  0x888354F7
  ¯ '` ¯
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.