commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karr, David" <david.k...@wamu.net>
Subject RE: How to make HttpClient NOT send "Proxy-Connection: Keep-Alive"?
Date Tue, 05 Sep 2006 18:02:54 GMT
Acknowledged.

I think I should provide a little more background here.

Each run of my test case involves sending a Post request to a url,
extracting a url from the response, sending a Get request to that URL,
and extracting the response.  I time that test case.  What I see is that
when I run the test case 4 times in a row on a single thread, the first
one takes about 1700 ms (for example), and the rest take about 600 ms.
This is repeatable.  If I instead have it run one testcase on four
separate threads, they all take about the same time (about 1500 ms).

I'm trying to coerce the environment so that those differences between
testcases on a single thread do not happen.  When I noticed the
Keep-Alive headers going across, I figured that might be causing this.

In a previous version of this test code, I was sending the first Post
request with a SOAPConnection call, instead of using HttpClient, and the
Get request was using HttpClient.  What I found was that if I added a
delay in the code between the test cases on a single thread (about 8-10
seconds), then I would see the difference go away.  I later changed the
code, replacing the first SOAPConnection call with HttpClient, and now
no matter how long my delay is (ok, I've only gone up to 30 seconds),
the 2nd-Nth requests are still faster.

So, is there any way I can convince HttpClient to make the connection go
away between each test case (between each pair of requests, that is)?  I
figured getting it to not send the "Keep-Alive" header would do it, but
apparently you're saying that that is necessary for SSL to work.

> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Sent: Tuesday, September 05, 2006 10:27 AM
> To: Jakarta Commons Users List
> Subject: RE: How to make HttpClient NOT send 
> "Proxy-Connection: Keep-Alive"?
> 
> On Tue, 2006-09-05 at 10:09 -0700, Karr, David wrote:
> > Well, the URL I'm going to is using https, but I'm not 
> doing anything 
> > specific with SSL in the HttpClient connection.
> > 
> 
> That pretty much explains why you are seeing "Proxy-Connection:
> Keep-Alive" headers with the traffic analyzer. These headers 
> are sent with the HTTP CONNECT method because if the 
> connection is not kept alive you would not be able to tunnel 
> secure connections through the proxy
> 
> Hope this helps somewhat.
> 
> Oleg
> 
> 
> 
> > > -----Original Message-----
> > > From: Oleg Kalnichevski [mailto:olegk@apache.org]
> > > Sent: Tuesday, September 05, 2006 9:27 AM
> > > To: Jakarta Commons Users List
> > > Subject: RE: How to make HttpClient NOT send
> > > "Proxy-Connection: Keep-Alive"?
> > > 
> > > On Tue, 2006-09-05 at 09:12 -0700, Karr, David wrote:
> > > > I'm confused.  This seemed like it would work.  I added two 
> > > > subclasses, one called "GetMethodNoKeepAlive", and the other 
> > > > "PostMethodNoKeepAlive".  I created instances of those 
> instead of 
> > > > "GetMethod" and "PostMethod".  Each of the subclasses 
> has an empty 
> > > > "addProxyConnectionHeader" method, except for a print
> > > statement saying
> > > > it got there.  I monitored the execution in Ethereal.  When it 
> > > > executed, I saw the print statements execute, but my timing
> > > behavior
> > > > made it look like it made no difference.  In my 
> Ethereal results, 
> > > > I still see the
> > > > "Proxy-Connection: Keep-Alive" when it connects to the
> > > external host.
> > > > 
> > > 
> > > David,
> > > 
> > > Are you using SSL tunneling by any chance? 
> > > 
> > > Oleg
> > > 
> > > > I even tried overriding the "shouldCloseConnection" method
> > > to return
> > > > true, in both classes.  Still no effect.
> > > > 
> > > > > -----Original Message-----
> > > > > From: Oleg Kalnichevski [mailto:olegk@apache.org]
> > > > > Sent: Tuesday, September 05, 2006 5:00 AM
> > > > > To: Jakarta Commons Users List
> > > > > Cc: Karr, David
> > > > > Subject: Re: How to make HttpClient NOT send
> > > > > "Proxy-Connection: Keep-Alive"?
> > > > > 
> > > > > On Wed, 2006-08-30 at 15:04 -0700, Karr, David wrote:
> > > > > > This may seem strange, but is it possible to make
> > > > > HttpClient NOT send
> > > > > > the "Proxy-Connection: Keep-Alive" header?
> > > > > > 
> > > > > 
> > > > > David,
> > > > > 
> > > > > There's no elegant solution to this problem. The only way to 
> > > > > work the problem around is to subclass method classes (such as
> > > GetMethod,
> > > > > PostMethod, and so on) and override the 
> > > > > HttpMethodBase#addProxyConnectionHeader method
> > > > > 
> > > > > Oleg
> > > > > 
> > > > > > I'm trying to write a test tool to load test an outside web
> > > > > service,
> > > > > > but doing it in a way that is somewhat consistent with
> > > an internal
> > > > > > application that will be calling that outside web 
> service.  My 
> > > > > > test tool can send the message multiple times so we can 
> > > > > > generate
> > > > > statistics
> > > > > > on the roundtrip time.  What I first noticed is that
> > > when I send N
> > > > > > messages on a thread, the 2nd-Nth message is faster
> > > than the first
> > > > > > one.  After examining the protocol behavior in
> > > Ethereal, I noticed
> > > > > > that HttpClient appears to be sending a "Proxy-Connection:
> > > > > Keep-Alive" 
> > > > > > header.  If I modified my test code to add a manual delay 
> > > > > > (9-10
> > > > > > seconds) between each message send, then the 2nd-Nth
> > > > > message timings
> > > > > > were about the same as the first one.
> > > > > > 
> > > > > > I'd prefer not to have that manual delay between 
> each message.  
> > > > > > For the sake of getting consistent results, is 
> there any way 
> > > > > > to disable the sending of the "Proxy-Connection:
> > > Keep-Alive" header?
> > > > > > 
> > > > > > 
> > > > > 
> > > 
> --------------------------------------------------------------------
> > > > > -
> > > > > > To unsubscribe, e-mail: 
> > > > > > commons-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail: 
> > > > > commons-user-help@jakarta.apache.org
> > > > > > 
> > > > > > 
> > > > > 
> > > > > 
> > > > > 
> > > 
> --------------------------------------------------------------------
> > > > > - To unsubscribe, e-mail: 
> > > > > commons-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail: 
> > > > > commons-user-help@jakarta.apache.org
> > > > > 
> > > > > 
> > > > 
> > > > 
> > > 
> --------------------------------------------------------------------
> > > -
> > > > To unsubscribe, e-mail: 
> > > > commons-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: 
> > > commons-user-help@jakarta.apache.org
> > > > 
> > > > 
> > > 
> > > 
> > > 
> --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: 
> > > commons-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> > > commons-user-help@jakarta.apache.org
> > > 
> > > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> commons-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 

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


Mime
View raw message