You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ra...@apache.org on 2011/02/14 16:21:45 UTC

svn commit: r1070519 - in /qpid/trunk/qpid/java/tools: bin/perf_report.sh etc/jndi.properties src/main/java/org/apache/qpid/tools/PerfBase.java src/main/java/org/apache/qpid/tools/TestParams.java

Author: rajith
Date: Mon Feb 14 15:21:44 2011
New Revision: 1070519

URL: http://svn.apache.org/viewvc?rev=1070519&view=rev
Log:
QPID-3055
As the first step added system properties for host, port and address and got rid of the jndi lookup.
There is also a system property for URL which allows a user to specify a fully fledged URL with various connection options like SSL etc..
If the host & port is specified the URL property is ignored.

I also added some documentation in the perf_report.sh suggesting recommended settings for performance testing.
These are guidelines only and a prospective user needs to experiment with their environment to fine tune the settings.

Removed:
    qpid/trunk/qpid/java/tools/etc/jndi.properties
Modified:
    qpid/trunk/qpid/java/tools/bin/perf_report.sh
    qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfBase.java
    qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/TestParams.java

Modified: qpid/trunk/qpid/java/tools/bin/perf_report.sh
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/tools/bin/perf_report.sh?rev=1070519&r1=1070518&r2=1070519&view=diff
==============================================================================
--- qpid/trunk/qpid/java/tools/bin/perf_report.sh (original)
+++ qpid/trunk/qpid/java/tools/bin/perf_report.sh Mon Feb 14 15:21:44 2011
@@ -25,6 +25,10 @@
 SUB_MEM=-Xmx1024M
 PUB_MEM=-Xmx1024M
 LOG_CONFIG="-Damqj.logging.level=WARN"
+QUEUE="queue;{create:always,node:{x-declare:{auto-delete:true}}}"
+DURA_QUEUE="dqueue;{create:always,node:{durable:true,x-declare:{auto-delete:true}}}"
+TOPIC="amq.topic/test"
+DURA_TOPIC="amq.topic/test;{create:always,link:{durable:true}}"
 
 . setenv.sh
 
@@ -72,60 +76,65 @@ echo "==================================
 echo "|Test           |System throuput|Producer rate|Consumer Rate|Avg Latency|Min Latency|Max Latency|"
 echo "------------------------------------------------------------------------------------------------"
 
+# The message counts and warmup counts are set to very low values for quick testing of the script.
+# For a real performance run I recommend setting warmup count to 10k and message count in excess of 100k
+# However for transactions, sync_publish and especially small durable transactions (which is quite slow) I recommend
+# setting very low values to start with and experiment while increasing them slowly.
+
 # Test 1 Trans Queue
-run_testcase "Trans_Queue" "" "-Dwarmup_count=1 -Dmsg_count=10"
+#run_testcase "Trans_Queue" "-Daddress=$QUEUE" "-Daddress=$QUEUE -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 2 Dura Queue
-run_testcase "Dura_Queue" "-Ddurable=true" "-Ddurable=true -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Dura_Queue" "-Daddress=$DURA_QUEUE -Ddurable=true" "-Daddress=$DURA_QUEUE -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 3 Dura Queue Sync
-run_testcase "Dura_Queue_Sync" "-Ddurable=true" "-Ddurable=true -Dwarmup_count=1 -Dmsg_count=10 -Dsync_persistence=true"
+run_testcase "Dura_Queue_Sync" "-Daddress=$DURA_QUEUE -Ddurable=true" "-Daddress=$DURA_QUEUE -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10 -Dsync_publish=persistent"
 
 # Test 4 Dura Queue Sync Publish and Ack
-run_testcase "Dura_SyncPubAck" "-Ddurable=true -Dsync_ack=true" "-Ddurable=true -Dwarmup_count=1 -Dmsg_count=10 -Dsync_publish=persistent"
+run_testcase "Dura_SyncPubAck" "-Daddress=$DURA_QUEUE -Ddurable=true -Dsync_ack=true" "-Daddress=$DURA_QUEUE -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10 -Dsync_publish=persistent"
 
 # Test 5 Topic
-run_testcase "Topic" "-DtransDest=transientTopic" "-DtransDest=transientTopic -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Topic" "-Daddress=$TOPIC" "-Daddress=$TOPIC -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 6 Durable Topic
-run_testcase "Dura_Topic" "-Ddurable=true -DtransDest=durableTopic" "-Ddurable=true -DtransDest=durableTopic -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Dura_Topic" "-Daddress=$DURA_TOPIC -Ddurable=true" "-Daddress=$DURA_TOPIC -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 7 Fanout
-run_testcase "Fanout" "-DtransDest=fanoutQueue" "-DtransDest=fanoutQueue -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Fanout" "-Daddress=amq.fanout" "-Daddress=amq.fanout -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 8 Small TX
-run_testcase "Small_Txs_2" "-Ddurable=true -Dtransacted=true -Dtrans_size=1" \
- "-Ddurable=true -Dwarmup_count=1 -Dmsg_count=10 -Dtransacted=true -Dtrans_size=1"
+run_testcase "Small_Txs_2" "-Daddress=$DURA_QUEUE -Ddurable=true -Dtransacted=true -Dtrans_size=1" \
+ "-Daddress=$DURA_QUEUE -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10 -Dtransacted=true -Dtrans_size=1"
 
 # Test 9 Large TX
-run_testcase "Large_Txs_1000" "-Ddurable=true -Dtransacted=true -Dtrans_size=10" \
- "-Ddurable=true -Dwarmup_count=1 -Dmsg_count=10 -Dtransacted=true -Dtrans_size=10"
+run_testcase "Large_Txs_1000" "-Daddress=$DURA_QUEUE -Ddurable=true -Dtransacted=true -Dtrans_size=10" \
+ "-Daddress=$DURA_QUEUE -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10 -Dtransacted=true -Dtrans_size=10"
 
 # Test 10 256 MSG
-run_testcase "Msg_256b" "" "-Dmsg_size=256 -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Msg_256b" "-Daddress=$QUEUE" "-Daddress=$QUEUE -Dmsg_size=256 -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 11 512 MSG
-run_testcase "Msg_512b" "" "-Dmsg_size=512 -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Msg_512b" "-Daddress=$QUEUE" "-Daddress=$QUEUE -Dmsg_size=512 -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 12 2048 MSG
-run_testcase "Msg_2048b" "" "-Dmsg_size=2048 -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Msg_2048b" "-Daddress=$QUEUE" "-Daddress=$QUEUE -Dmsg_size=2048 -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 13 Random size MSG
-run_testcase "Random_Msg_Size" "" "-Drandom_msg_size=true -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Random_Msg_Size" "-Daddress=$QUEUE" "-Daddress=$QUEUE -Drandom_msg_size=true -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 14 Random size MSG Durable
-run_testcase "Rand_Msg_Dura" "-Ddurable=true" "-Ddurable=true -Drandom_msg_size=true -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Rand_Msg_Dura" "-Daddress=$DURA_QUEUE -Ddurable=true" "-Daddress=$DURA_QUEUE -Ddurable=true -Drandom_msg_size=true -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 15 64K MSG
-run_testcase "Msg_64K" "-Damqj.tcpNoDelay=true" "-Damqj.tcpNoDelay=true -Dmsg_size=64000 -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Msg_64K" "-Daddress=$QUEUE -Damqj.tcpNoDelay=true" "-Daddress=$QUEUE -Damqj.tcpNoDelay=true -Dmsg_size=64000 -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 16 Durable 64K MSG
-run_testcase "Msg_Durable_64K" "-Ddurable=true -Damqj.tcpNoDelay=true" \
- "-Damqj.tcpNoDelay=true -Dmsg_size=64000 -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Msg_Durable_64K" "-Daddress=$DURA_QUEUE -Ddurable=true -Damqj.tcpNoDelay=true" \
+ "-Daddress=$DURA_QUEUE -Damqj.tcpNoDelay=true -Dmsg_size=64000 -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 17 500K MSG
-run_testcase "Msg_500K" "-Damqj.tcpNoDelay=true" "-Damqj.tcpNoDelay=true -Dmsg_size=500000 -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Msg_500K" "-Daddress=$QUEUE -Damqj.tcpNoDelay=true" "-Daddress=$QUEUE -Damqj.tcpNoDelay=true -Dmsg_size=500000 -Dwarmup_count=1 -Dmsg_count=10"
 
 # Test 18 Durable 500K MSG
-run_testcase "Msg_Dura_500K" "-Damqj.tcpNoDelay=true -Ddurable=true" \
- "-Damqj.tcpNoDelay=true -Dmsg_size=500000 -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10"
+run_testcase "Msg_Dura_500K" "-Daddress=$DURA_QUEUE -Damqj.tcpNoDelay=true -Ddurable=true" \
+ "-Daddress=$DURA_QUEUE -Damqj.tcpNoDelay=true -Dmsg_size=500000 -Ddurable=true -Dwarmup_count=1 -Dmsg_count=10"

Modified: qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfBase.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfBase.java?rev=1070519&r1=1070518&r2=1070519&view=diff
==============================================================================
--- qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfBase.java (original)
+++ qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/PerfBase.java Mon Feb 14 15:21:44 2011
@@ -30,6 +30,9 @@ import javax.jms.Session;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 
+import org.apache.qpid.client.AMQAnyDestination;
+import org.apache.qpid.client.AMQConnection;
+
 public class PerfBase
 {
     TestParams params;
@@ -45,48 +48,21 @@ public class PerfBase
     }
 
     public void setUp() throws Exception
-    {
-        Hashtable<String,String> env = new Hashtable<String,String>();
-        env.put(Context.INITIAL_CONTEXT_FACTORY, params.getInitialContextFactory());
-        env.put(Context.PROVIDER_URL, params.getProviderURL());
+    {        
 
-        Context ctx = null;
-        try
+        if (params.getHost().equals("") || params.getPort() == -1)
         {
-            ctx = new InitialContext(env);
+            con = new AMQConnection(params.getUrl());
         }
-        catch(Exception e)
+        else
         {
-            throw new Exception("Error initializing JNDI",e);
-
+            con = new AMQConnection(params.getHost(),params.getPort(),"guest","guest","test","test");
         }
-
-        ConnectionFactory conFac = null;
-        try
-        {
-            conFac = (ConnectionFactory)ctx.lookup(params.getConnectionFactory());
-        }
-        catch(Exception e)
-        {
-            throw new Exception("Error looking up connection factory",e);
-        }
-
-        con = conFac.createConnection();
         con.start();
         session = con.createSession(params.isTransacted(),
                                     params.isTransacted()? Session.SESSION_TRANSACTED:params.getAckMode());
 
-        try
-        {
-            dest = (Destination)ctx.lookup( params.isDurable()?
-                                            params.getDurableDestination():
-                                            params.getTransientDestination()
-                                           );
-        }
-        catch(Exception e)
-        {
-            throw new Exception("Error looking up destination",e);
-        }
+        dest = new AMQAnyDestination(params.getAddress());
     }
 
     public void handleError(Exception e,String msg)

Modified: qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/TestParams.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/TestParams.java?rev=1070519&r1=1070518&r2=1070519&view=diff
==============================================================================
--- qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/TestParams.java (original)
+++ qpid/trunk/qpid/java/tools/src/main/java/org/apache/qpid/tools/TestParams.java Mon Feb 14 15:21:44 2011
@@ -24,15 +24,22 @@ import javax.jms.Session;
 
 public class TestParams
 {
-    private String initialContextFactory = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory";
-
-    private String providerURL = System.getenv("QPID_TEST_HOME") + "/etc/jndi.properties";
-
-    private String connectionFactory = "connectionFactory";
-
-    private String transientDest = "transientQueue";
+    /*
+     * By default the connection URL is used. 
+     * This allows a user to easily specify a fully fledged URL any given property.
+     * Ex. SSL parameters
+     *  
+     * By providing a host & port allows a user to simply override the URL.
+     * This allows to create multiple clients in test scripts easily,
+     * without having to deal with the long URL format. 
+     */
+    private String url = "amqp://guest:guest@clientid/testpath?brokerlist='tcp://localhost:5672'";
+    
+    private String host = "";
+    
+    private int port = -1;
 
-    private String durableDest = "durableQueue";
+    private String address = "queue; {create : always}";
 
     private int msg_size = 1024;
 
@@ -60,11 +67,11 @@ public class TestParams
 
     public TestParams()
     {
-        initialContextFactory = System.getProperty("java.naming.factory.initial",initialContextFactory);
-        providerURL = System.getProperty("java.naming.provider.url",providerURL);
-
-        transientDest = System.getProperty("transDest",transientDest);
-        durableDest = System.getProperty("durableDest",durableDest);
+     
+        url = System.getProperty("url",url);
+        host = System.getProperty("host","");
+        port = Integer.getInteger("port", -1);
+        address = System.getProperty("address","queue");
 
         msg_size  = Integer.getInteger("msg_size", 1024);
         msg_type = Integer.getInteger("msg_type",1);
@@ -80,29 +87,29 @@ public class TestParams
         random_msg_size = Boolean.getBoolean("random_msg_size");
     }
 
-    public int getAckMode()
+    public String getUrl()
     {
-        return ack_mode;
+        return url;
     }
 
-    public String getConnectionFactory()
+    public String getHost()
     {
-        return connectionFactory;
+        return host;
     }
 
-    public String getTransientDestination()
+    public int getPort()
     {
-        return transientDest;
+        return port;
     }
 
-    public String getDurableDestination()
+    public String getAddress()
     {
-        return durableDest;
+        return address;
     }
 
-    public String getInitialContextFactory()
+    public int getAckMode()
     {
-        return initialContextFactory;
+        return ack_mode;
     }
 
     public int getMsgCount()
@@ -125,11 +132,6 @@ public class TestParams
         return durable;
     }
 
-    public String getProviderURL()
-    {
-        return providerURL;
-    }
-
     public boolean isTransacted()
     {
         return transacted;



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org