Upgraded Jetty; minor benchmark improvements

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1080382 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2011-03-10 22:45:30 +00:00
parent f3e3302b7e
commit dcfced133b
6 changed files with 20 additions and 6 deletions

View File

@ -74,13 +74,13 @@
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId> <artifactId>jetty-server</artifactId>
<version>7.2.2.v20101205</version> <version>7.3.1.v20110307</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId> <artifactId>jetty-client</artifactId>
<version>7.2.2.v20101205</version> <version>7.3.1.v20110307</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -90,6 +90,7 @@ public static void main(String[] args) throws Exception {
content[i] = (byte) ((r + i) % 96 + 32); content[i] = (byte) ((r + i) % 96 + 32);
} }
URI warmup = new URI("http", null, "localhost", port, "/rnd", "c=2048", null);
URI target1 = new URI("http", null, "localhost", port, "/rnd", "c=" + contentLen, null); URI target1 = new URI("http", null, "localhost", port, "/rnd", "c=" + contentLen, null);
URI target2 = new URI("http", null, "localhost", port, "/echo", null, null); URI target2 = new URI("http", null, "localhost", port, "/echo", null, null);
@ -98,7 +99,7 @@ public static void main(String[] args) throws Exception {
try { try {
agent.init(); agent.init();
// Warm up // Warm up
agent.get(target1, 5, 500); agent.get(warmup, 5, 500);
// Sleep a little // Sleep a little
Thread.sleep(5000); Thread.sleep(5000);
System.out.println("================================="); System.out.println("=================================");

View File

@ -125,7 +125,11 @@ public void run() {
contentLen += l; contentLen += l;
} }
} }
this.stats.success(contentLen); if (httpmethod.getStatusCode() == 200) {
this.stats.success(contentLen);
} else {
this.stats.failure(contentLen);
}
} catch (IOException ex) { } catch (IOException ex) {
this.stats.failure(contentLen); this.stats.failure(contentLen);
} finally { } finally {

View File

@ -151,7 +151,11 @@ public void run() {
instream.close(); instream.close();
} }
} }
this.stats.success(contentLen); if (response.getStatusLine().getStatusCode() == 200) {
this.stats.success(contentLen);
} else {
this.stats.failure(contentLen);
}
} catch (IOException ex) { } catch (IOException ex) {
this.stats.failure(contentLen); this.stats.failure(contentLen);
request.abort(); request.abort();

View File

@ -195,7 +195,11 @@ public void run() {
it.next(); it.next();
it.remove(); it.remove();
} }
this.stats.success(contentLen); if (response.getStatusLine().getStatusCode() == 200) {
this.stats.success(contentLen);
} else {
this.stats.failure(contentLen);
}
} catch (IOException ex) { } catch (IOException ex) {
this.stats.failure(contentLen); this.stats.failure(contentLen);
} catch (HttpException ex) { } catch (HttpException ex) {

View File

@ -70,6 +70,7 @@ Stats execute(final URI targetURI, byte[] content, int n, int c) throws Exceptio
try { try {
this.client.send(exchange); this.client.send(exchange);
} catch (IOException ex) { } catch (IOException ex) {
stats.failure(0);
} }
} }
stats.waitFor(); stats.waitFor();