Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 15373 invoked from network); 5 Sep 2006 18:03:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Sep 2006 18:03:50 -0000 Received: (qmail 90358 invoked by uid 500); 5 Sep 2006 18:03:45 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 90293 invoked by uid 500); 5 Sep 2006 18:03:44 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 90282 invoked by uid 99); 5 Sep 2006 18:03:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2006 11:03:44 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of david.karr@wamu.net designates 167.88.201.31 as permitted sender) Received: from [167.88.201.31] (HELO mtao001.wamu.net) (167.88.201.31) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Sep 2006 11:03:43 -0700 Received: from ([10.144.81.61]) by mtao001.wamu.net with ESMTP id KP-BXZ13.165552353; Tue, 05 Sep 2006 11:02:55 -0700 Received: from EXMSEA005.us.wamu.net ([10.144.81.24]) by exisea012.us.wamu.net with Microsoft SMTPSVC(6.0.3790.1830); Tue, 5 Sep 2006 11:02:55 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: How to make HttpClient NOT send "Proxy-Connection: Keep-Alive"? Date: Tue, 5 Sep 2006 11:02:54 -0700 Message-ID: <0C260F619E428642BFA6380177C3ADF3041BF83C@exmsea005.us.wamu.net> In-Reply-To: <1157477194.4983.62.camel@localhost.localdomain> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How to make HttpClient NOT send "Proxy-Connection: Keep-Alive"? thread-index: AcbREJCK1g4hJpOeTMadjgjGSZdg3AAAdfLQ From: "Karr, David" To: "Jakarta Commons Users List" X-OriginalArrivalTime: 05 Sep 2006 18:02:55.0419 (UTC) FILETIME=[834FA0B0:01C6D115] X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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]=20 > Sent: Tuesday, September 05, 2006 10:27 AM > To: Jakarta Commons Users List > Subject: RE: How to make HttpClient NOT send=20 > "Proxy-Connection: Keep-Alive"? >=20 > 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=20 > doing anything=20 > > specific with SSL in the HttpClient connection. > >=20 >=20 > That pretty much explains why you are seeing "Proxy-Connection: > Keep-Alive" headers with the traffic analyzer. These headers=20 > are sent with the HTTP CONNECT method because if the=20 > connection is not kept alive you would not be able to tunnel=20 > secure connections through the proxy >=20 > Hope this helps somewhat. >=20 > Oleg >=20 >=20 >=20 > > > -----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"? > > >=20 > > > On Tue, 2006-09-05 at 09:12 -0700, Karr, David wrote: > > > > I'm confused. This seemed like it would work. I added two=20 > > > > subclasses, one called "GetMethodNoKeepAlive", and the other=20 > > > > "PostMethodNoKeepAlive". I created instances of those=20 > instead of=20 > > > > "GetMethod" and "PostMethod". Each of the subclasses=20 > has an empty=20 > > > > "addProxyConnectionHeader" method, except for a print > > > statement saying > > > > it got there. I monitored the execution in Ethereal. When it=20 > > > > executed, I saw the print statements execute, but my timing > > > behavior > > > > made it look like it made no difference. In my=20 > Ethereal results,=20 > > > > I still see the > > > > "Proxy-Connection: Keep-Alive" when it connects to the > > > external host. > > > >=20 > > >=20 > > > David, > > >=20 > > > Are you using SSL tunneling by any chance?=20 > > >=20 > > > Oleg > > >=20 > > > > I even tried overriding the "shouldCloseConnection" method > > > to return > > > > true, in both classes. Still no effect. > > > >=20 > > > > > -----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"? > > > > >=20 > > > > > 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? > > > > > >=20 > > > > >=20 > > > > > David, > > > > >=20 > > > > > There's no elegant solution to this problem. The only way to=20 > > > > > work the problem around is to subclass method classes (such as > > > GetMethod, > > > > > PostMethod, and so on) and override the=20 > > > > > HttpMethodBase#addProxyConnectionHeader method > > > > >=20 > > > > > Oleg > > > > >=20 > > > > > > 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=20 > service. My=20 > > > > > > test tool can send the message multiple times so we can=20 > > > > > > 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"=20 > > > > > > header. If I modified my test code to add a manual delay=20 > > > > > > (9-10 > > > > > > seconds) between each message send, then the 2nd-Nth > > > > > message timings > > > > > > were about the same as the first one. > > > > > >=20 > > > > > > I'd prefer not to have that manual delay between=20 > each message. =20 > > > > > > For the sake of getting consistent results, is=20 > there any way=20 > > > > > > to disable the sending of the "Proxy-Connection: > > > Keep-Alive" header? > > > > > >=20 > > > > > >=20 > > > > >=20 > > >=20 > -------------------------------------------------------------------- > > > > > - > > > > > > To unsubscribe, e-mail:=20 > > > > > > commons-user-unsubscribe@jakarta.apache.org > > > > > > For additional commands, e-mail:=20 > > > > > commons-user-help@jakarta.apache.org > > > > > >=20 > > > > > >=20 > > > > >=20 > > > > >=20 > > > > >=20 > > >=20 > -------------------------------------------------------------------- > > > > > - To unsubscribe, e-mail:=20 > > > > > commons-user-unsubscribe@jakarta.apache.org > > > > > For additional commands, e-mail:=20 > > > > > commons-user-help@jakarta.apache.org > > > > >=20 > > > > >=20 > > > >=20 > > > >=20 > > >=20 > -------------------------------------------------------------------- > > > - > > > > To unsubscribe, e-mail:=20 > > > > commons-user-unsubscribe@jakarta.apache.org > > > > For additional commands, e-mail:=20 > > > commons-user-help@jakarta.apache.org > > > >=20 > > > >=20 > > >=20 > > >=20 > > >=20 > -------------------------------------------------------------------- > > > - To unsubscribe, e-mail:=20 > > > commons-user-unsubscribe@jakarta.apache.org > > > For additional commands, e-mail:=20 > > > commons-user-help@jakarta.apache.org > > >=20 > > >=20 > >=20 > >=20 > --------------------------------------------------------------------- > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail:=20 > commons-user-help@jakarta.apache.org > >=20 > >=20 >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org >=20 >=20 --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org