HttpClient benchmark improvements

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1080204 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2011-03-10 12:55:42 +00:00
parent 1b1d692a3d
commit f3e3302b7e
4 changed files with 10 additions and 14 deletions

View File

@ -74,13 +74,13 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>7.2.0.v20101020</version>
<version>7.2.2.v20101205</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>7.2.0.v20101020</version>
<version>7.2.2.v20101205</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -98,7 +98,7 @@
<dependency>
<groupId>com.ning</groupId>
<artifactId>async-http-client</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -49,7 +49,7 @@ public class Benchmark {
public static void main(String[] args) throws Exception {
String ns = System.getProperty("hc.benchmark.n-requests", "200000");
String nc = System.getProperty("hc.benchmark.concurrent", "100");
String nc = System.getProperty("hc.benchmark.concurrent", "20");
String cls = System.getProperty("hc.benchmark.content-len", "2048");
int n = Integer.parseInt(ns);
@ -75,9 +75,6 @@ public class Benchmark {
server.start();
int port = connector.getLocalPort();
// Sleep a little
Thread.sleep(2000);
TestHttpAgent[] agents = new TestHttpAgent[] {
new TestHttpClient3(),
new TestHttpJRE(),
@ -98,8 +95,12 @@ public class Benchmark {
try {
for (TestHttpAgent agent: agents) {
agent.init();
try {
agent.init();
// Warm up
agent.get(target1, 5, 500);
// Sleep a little
Thread.sleep(5000);
System.out.println("=================================");
System.out.println("HTTP agent: " + agent.getClientName());
System.out.println("---------------------------------");
@ -121,7 +122,6 @@ public class Benchmark {
} finally {
agent.shutdown();
}
agent.init();
System.out.println("---------------------------------");
}
} finally {

View File

@ -97,7 +97,6 @@ public class Stats {
final URI targetURI, long startTime, long finishTime, final Stats stats) {
float totalTimeSec = (float) (finishTime - startTime) / 1000;
float reqsPerSec = (float) stats.getSuccessCount() / totalTimeSec;
float timePerReqMs = (float) (finishTime - startTime) / (float) stats.getSuccessCount();
System.out.print("Document URI:\t\t");
System.out.println(targetURI);
@ -120,9 +119,6 @@ public class Stats {
System.out.print("Requests per second:\t");
System.out.print(reqsPerSec);
System.out.println(" [#/sec] (mean)");
System.out.print("Time per request:\t");
System.out.print(timePerReqMs);
System.out.println(" [ms] (mean)");
}
}

View File

@ -94,7 +94,7 @@ public class TestNingHttpClient implements TestHttpAgent {
}
public String getClientName() {
return "Ning Async HTTP client 1.4.0";
return "Ning async HTTP client 1.5.0";
}
static class SimpleAsyncHandler implements AsyncHandler<Object> {