Skip to content

Apache http components

December 20, 2011

On starting testing on EC2, we noticed the test script suddenly requiring a lot of CPU-cycles. Since we want to run the test-script on the same machine as the server to reduce network influences, this is a problem.

Looking at some stack traces, quickly apache http components were identified.

Better insights, as always, were available by using the hprof java agent:

java -agentlib:hprof=cpu=times -jar dist/tagsobe.jar  ...

A lot of calls to verify X.509 certificates for ssl connections! After using our own SchemeRegistry, CPU load was reduced:

SchemeRegistry registry = new SchemeRegistry();
registry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
SingleClientConnManager connManager = new SingleClientConnManager(registry);
httpClient = new DefaultHttpClient(connManager);

hprof now showed java.net.SocketInputStream.socketRead0 as the by far most active method.

Advertisements

From → Benchmarking

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: