commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Sutton <adrian.sut...@ephox.com>
Subject RE: [httpclient] one pakcet per HTTP header?
Date Tue, 25 Feb 2003 01:29:05 GMT
Hi Nakagome,
Yep that makes a lot more sense now.  I'm not sure how much luck you're
going to have getting that much low level control from Java, but if you can
work that part out you should be able to get HttpClient to use a custom
HttpConnection by passing in your own HttpConnectionManager that creates
"MyHttpConnection" instances instead of HttpConnection instances.  So you'd
get something like:

public class Tester {

	public static void main(String[] args) {
		HttpClient client = new HttpClient(new
MyHttpConnectionManager());
		// run your tests using client.
	}
}

public class MyHttpConnectionManager implements HttpConnection {
	
	public HttpConnection getConnection(HostConfiguration hc) {
		HttpConnection conn = new MyHttpConnection(hc);
		conn.setHttpConnectionManager(this);
	}

	.... Implement the other 2 methods as required by your app...
}

then obviously you'd need to create a class that extends HttpConnection and
overrides methods to achieve whatever packet grouping you need.

Hope that helps, I have no idea if what you want is possible, but this
should get HttpClient out of your way and let you have a crack at it anyway.
:)  I suppose a packet is sent whenever flush() is called on the output
stream so strategically calling that may help (remember that println usually
calls flush automatically).

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com


-----Original Message-----
From: Nakagome Tomoyuki [mailto:nakagome@fa2.so-net.ne.jp]
Sent: Tuesday, 25 February 2003 11:20 AM
To: Jakarta Commons Users List
Subject: RE: [httpclient] one pakcet per HTTP header?


Thanks, Adrian.

Here's the background. I am writing a load-generation program that emulates
certain browser on mobile devices. The purpose of this emulator is to test
the performance of gateway servers between the mobile devices and the
Internet.
Since the browser sends out as many headers as possible in one packet,
I need to emulate that behavior, too.

I saw much less number of packets when I used the Java standard
HttpURLConnection, but then I could not control the timeout values with
that class. The class in Java 1.4.1 seemed to perform better than
Commons httpclient, but this may be due to my bad programming.
(CPU load was constant with HttpURLConnection, but I saw spikes
in CPU usage when I used Commons client.)

Does this answer your question?

Mime
View raw message