hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Thompson" <Tony.Thomp...@stone-ware.com>
Subject RE: Question about MultiThreadedHttpConnectionManager
Date Fri, 06 Apr 2007 17:28:31 GMT

>> The issue seems to be that in the middle of an HTTP 1.1 conversation,

>> the client is opening a second socket to the host and is splitting
>> requests across the two sockets.  Even though all of the data is 
>> getting to the server, the server is confused by the fact that it is 
>> now coming in from 2 different connections.
>It is perfectly normal for a client application (Browser, HttpClient)
to open more than one connection if requests can be executed 
>If the server gets confused by that, the server application is broken.
>Nevertheless, you can set the "connections per host" limit of the
connection manager to 1, then only one connection will be used and no 
>requests are executed in parallel.

I understand that but this is where things get a little fuzzy for me.
If my client opens a persistent HTTP 1.1 connection to the server and
sends 4 requests and then sends the 5th request with a Connection: close
header, all 5 of those requests are supposed to be sent over the same
connection, right?  What is happening and what I was attempting to
demonstrate in my primitive picture was the fact that the HttpClient at
some point decides that it is going to start a new connection and splits
those 5 requests across 2 connections.  In my application, the same
thread is sending all 5 of those requests but I do have other threads
sendings requests to the same host at that time.  Once the load starts
to increase, the MTHCM starts opening more connections as it should but
those connections start getting crossed up more as things go on.  For
most HTTP conversations having those requests split across multiple
connections may not be a big deal other than not being as efficient with
the server as it should.  But, I have seen WebDAV requests that are
expecting all 5 of those requests to come through on the same connection
blow chunks because the HttpClient is breaking protocol.  Am I missing
some key piece of information here?

>> 4. proxy does HttpClient.executeMethod( hostConfig, method )
>HttpClient has only one default HttpState. A proxy that is serving
multiple clients should maintain a separate HttpState for each client 
>session, and pass that state in the executeMethod call.
>Otherwise, a backend server that uses cookies to trace client sessions
will indeed get confused, because the wrong cookies are sent 

I am not keeping state in the server since it is really just a
transparent proxy so client state is maintained in the originating

If some of my assumptions above are correct, is there something I can do
to work better with the HttpClient or does the HttpClient need to handle
this differently?

This message (and any associated files) is intended only for the 
use of the individual or entity to which it is addressed and may 
contain information that is confidential, subject to copyright or
constitutes a trade secret. If you are not the intended recipient 
you are hereby notified that any dissemination, copying or 
distribution of this message, or files associated with this message, 
is strictly prohibited. If you have received this message in error, 
please notify us immediately by replying to the message and deleting 
it from your computer. Messages sent to and from Stoneware, Inc.
may be monitored.

To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

View raw message