[jboss-cvs] JBossAS SVN: r68997 - projects/cluster/varia/sessionstress.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 15 17:12:01 EST 2008
Author: bstansberry at jboss.com
Date: 2008-01-15 17:12:01 -0500 (Tue, 15 Jan 2008)
New Revision: 68997
Modified:
projects/cluster/varia/sessionstress/PerfTest2.java
Log:
Track keep-alive pct
Modified: projects/cluster/varia/sessionstress/PerfTest2.java
===================================================================
--- projects/cluster/varia/sessionstress/PerfTest2.java 2008-01-15 22:04:53 UTC (rev 68996)
+++ projects/cluster/varia/sessionstress/PerfTest2.java 2008-01-15 22:12:01 UTC (rev 68997)
@@ -53,7 +53,7 @@
barrier.await();
long total_time=0, total_bytes_read=0, total_bytes_written=0;
- int total_successful_reads=0, total_successful_writes=0, total_failed_reads=0, total_failed_writes=0;
+ int total_successful_reads=0, total_successful_writes=0, total_failed_reads=0, total_failed_writes=0, total_connection_closes=0;
int num_clients=0;
for(Client client: clients) {
@@ -68,6 +68,7 @@
total_successful_writes+=client.getSuccessfulWrites();
total_failed_reads+=client.getFailedReads();
total_failed_writes+=client.getFailedWrites();
+ total_connection_closes+=client.getConnectionCloses();
}
if(num_clients < 1) {
@@ -79,6 +80,7 @@
int total_requests=total_successful_reads + total_successful_writes;
double avg_time=total_time / num_clients;
double reqs_sec=total_requests / (avg_time / 1000.0);
+ int keep_alive_pct = (total_requests - total_connection_closes) / (total_requests * 100);
System.out.println("\nTotal requests: " + total_requests + " in (avg) " + (avg_time / 1000.0) + " secs");
System.out.println("\n*** " + f.format(reqs_sec) + " requests/sec, requests/sec/client: " +
@@ -90,6 +92,7 @@
System.out.println("Bytes read/sec: " + printBytes(total_bytes_read / (avg_time / 1000.0)) + ", bytes written/sec: " +
printBytes(total_bytes_written / (avg_time / 1000.0)));
System.out.println("Total client: " + num_clients + ", failed clients: " + failed_clients);
+ System.out.println("Keep-alive percentage: " + keep_alive_pct);
}
private static String printBytes(long bytes) {
@@ -219,6 +222,7 @@
private int successful_reads=0, failed_reads=0, successful_writes=0, failed_writes=0;
private long bytes_read=0, bytes_written=0;
private long start=0, stop=0;
+ private int connectionCloses=0;
private boolean successful=true;
private final byte[] buffer=new byte[1024];
private String cookie=null;
@@ -289,6 +293,10 @@
public int getSuccessfulWrites() {
return successful_writes;
}
+
+ public int getConnectionCloses() {
+ return connectionCloses;
+ }
public long getTime() {
return stop - start;
@@ -337,8 +345,7 @@
}
else {
failed_writes++;
- }
- Thread.currentThread().yield();
+ }
}
total++;
if(!silent && print > 0 && total % print == 0)
@@ -372,6 +379,10 @@
System.out.println("Cookie changed: was: " + cookie + " is: " + tmp_cookie);
}
}
+ String connectionHeader=conn.getHeaderField("Connection");
+ if (connectionHeader != null && connectionHeader.indexOf("close") > -1)
+ connectionCloses++;
+
return conn.getResponseCode();
}
finally {
More information about the jboss-cvs-commits
mailing list