[jboss-cvs] JBossAS SVN: r68856 - projects/cluster/varia/sessionstress.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 10 18:48:57 EST 2008


Author: bela at jboss.com
Date: 2008-01-10 18:48:57 -0500 (Thu, 10 Jan 2008)
New Revision: 68856

Modified:
   projects/cluster/varia/sessionstress/PerfTest.java
Log:
MultiThreaded connection pool

Modified: projects/cluster/varia/sessionstress/PerfTest.java
===================================================================
--- projects/cluster/varia/sessionstress/PerfTest.java	2008-01-10 23:46:03 UTC (rev 68855)
+++ projects/cluster/varia/sessionstress/PerfTest.java	2008-01-10 23:48:57 UTC (rev 68856)
@@ -3,6 +3,7 @@
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
 import org.apache.commons.httpclient.methods.GetMethod;
 
 import javax.naming.NamingException;
@@ -20,6 +21,7 @@
 public class PerfTest {
     private Client[] clients;
     private CyclicBarrier barrier;
+    private MultiThreadedHttpConnectionManager pool=new MultiThreadedHttpConnectionManager();
 
     static NumberFormat f;
 
@@ -32,7 +34,12 @@
 
     
     private void start(String host, String setup_url, String read_url, String write_url, String destroy_url,
-                       int num_threads, int num_requests, int num_attrs, int size, int write_percentage) throws NamingException, BrokenBarrierException, InterruptedException {
+                       int num_threads, int num_requests, int num_attrs, int size, int write_percentage)
+            throws NamingException, BrokenBarrierException, InterruptedException {
+        HttpConnectionManagerParams params=new HttpConnectionManagerParams();
+        params.setDefaultMaxConnectionsPerHost(200);
+        params.setMaxTotalConnections(500);
+        pool.setParams(params);
         this.clients=new Client[num_threads];
         this.barrier=new CyclicBarrier(num_threads + 1);
         System.out.println("Starting " + num_threads + " clients");
@@ -46,6 +53,8 @@
         System.out.println("Waiting for clients to complete");
         barrier.await();
 
+        pool.shutdown();
+
         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;
 




More information about the jboss-cvs-commits mailing list