activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/2] activemq-artemis git commit: modifying perf example to accept amqp connections as well
Date Mon, 21 Sep 2015 22:36:35 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master dc3b01036 -> bfaaae8c9


modifying perf example to accept amqp connections as well


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/0354944e
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/0354944e
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/0354944e

Branch: refs/heads/master
Commit: 0354944e8f6f261a405248ac497c77e50d3b24d2
Parents: dc3b010
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Sep 21 17:45:00 2015 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Sep 21 17:46:50 2015 -0400

----------------------------------------------------------------------
 examples/features/perf/perf/pom.xml             |  6 ++++
 examples/features/perf/perf/readme.html         |  6 ++--
 .../activemq/artemis/jms/example/PerfBase.java  | 22 +++++++++++---
 .../artemis/jms/example/PerfParams.java         | 32 +++++++++++++++++---
 .../perf/src/main/resources/perf.properties     | 18 +++++++----
 5 files changed, 66 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0354944e/examples/features/perf/perf/pom.xml
----------------------------------------------------------------------
diff --git a/examples/features/perf/perf/pom.xml b/examples/features/perf/perf/pom.xml
index d5307e6..d67d47d 100644
--- a/examples/features/perf/perf/pom.xml
+++ b/examples/features/perf/perf/pom.xml
@@ -57,6 +57,12 @@ under the License.
          <artifactId>artemis-cli</artifactId>
          <version>${project.version}</version>
       </dependency>
+      <dependency>
+         <groupId>org.apache.qpid</groupId>
+         <artifactId>qpid-jms-client</artifactId>
+         <version>0.5.0</version>
+      </dependency>
+
    </dependencies>
 
    <profiles>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0354944e/examples/features/perf/perf/readme.html
----------------------------------------------------------------------
diff --git a/examples/features/perf/perf/readme.html b/examples/features/perf/perf/readme.html
index aa42266..ab2d50e 100644
--- a/examples/features/perf/perf/readme.html
+++ b/examples/features/perf/perf/readme.html
@@ -27,11 +27,11 @@ under the License.
   <body onload="prettyPrint()">
     <h1>JMS Simple Performance</h1>
 
-    <p>To start the server run <code>mvn verify -Pexample</code></p>
+    <p>To start the server run <code>mvn verify -Pserver</code></p>
 
-    <p>To start the listener run <code>mvn -Plistener package</code></p>
+    <p>To start the listener run <code>mvn -Plistener verify</code></p>
 
-    <p>To start the sender run <code>mvn -Psender package</code></p>
+    <p>To start the sender run <code>mvn -Psender verify</code></p>
 
     <p>To configure the clients simply edit the <code>perf.properties</code>
or <code>client.jndi.properties</code> in the
         <code>src/main/resources</code> directory</p>

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0354944e/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java
----------------------------------------------------------------------
diff --git a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java
b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java
index 8fcafa4..006d495 100644
--- a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java
+++ b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfBase.java
@@ -37,6 +37,7 @@ import java.util.logging.Logger;
 
 import org.apache.activemq.artemis.utils.TokenBucketLimiter;
 import org.apache.activemq.artemis.utils.TokenBucketLimiterImpl;
+import org.apache.qpid.jms.JmsConnectionFactory;
 
 public abstract class PerfBase {
 
@@ -99,7 +100,7 @@ public abstract class PerfBase {
       boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege"));
       boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id"));
       boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp"));
-      boolean openwire = Boolean.valueOf(props.getProperty("openwire", "true"));
+      String clientLibrary = props.getProperty("client-library", "core");
       String uri = props.getProperty("server-uri", "tcp://localhost:61616");
 
       PerfBase.log.info("num-messages: " + noOfMessages);
@@ -115,7 +116,7 @@ public abstract class PerfBase {
       PerfBase.log.info("disable-message-timestamp: " + disableTimestamp);
       PerfBase.log.info("dups-ok-acknowledge: " + dupsOK);
       PerfBase.log.info("server-uri: " + uri);
-      PerfBase.log.info("openwire:" + openwire);
+      PerfBase.log.info("client-library:" + clientLibrary);
 
       PerfParams perfParams = new PerfParams();
       perfParams.setNoOfMessagesToSend(noOfMessages);
@@ -130,7 +131,7 @@ public abstract class PerfBase {
       perfParams.setDisableMessageID(disableMessageID);
       perfParams.setDisableTimestamp(disableTimestamp);
       perfParams.setDupsOK(dupsOK);
-      perfParams.setOpenwire(openwire);
+      perfParams.setLibraryType(clientLibrary);
       perfParams.setUri(uri);
 
       return perfParams;
@@ -160,7 +161,7 @@ public abstract class PerfBase {
 
          connection = factory.createConnection();
       }
-      else {
+      else if (perfParams.isCore()) {
          factory = new  org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(perfParams.getUri());
 
          destination = new org.apache.activemq.artemis.jms.client.ActiveMQQueue(perfParams.getDestinationName());
@@ -168,6 +169,19 @@ public abstract class PerfBase {
          connection = factory.createConnection();
 
       }
+      else if (perfParams.isAMQP()) {
+         factory = new JmsConnectionFactory(perfParams.getUri());
+
+         destination = new org.apache.activemq.artemis.jms.client.ActiveMQQueue(perfParams.getDestinationName());
+
+         connection = factory.createConnection();
+
+         Session sessionX = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         destination = sessionX.createQueue(perfParams.getDestinationName());
+
+         sessionX.close();
+      }
 
       session = connection.createSession(perfParams.isSessionTransacted(), perfParams.isDupsOK()
? Session.DUPS_OK_ACKNOWLEDGE : Session.AUTO_ACKNOWLEDGE);
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0354944e/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java
----------------------------------------------------------------------
diff --git a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java
b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java
index ce78ffd..3e192c0 100644
--- a/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java
+++ b/examples/features/perf/perf/src/main/java/org/apache/activemq/artemis/jms/example/PerfParams.java
@@ -25,6 +25,12 @@ public class PerfParams implements Serializable {
 
    private static final long serialVersionUID = -4336539641012356002L;
 
+   enum ClientLibraryType {
+      core, openwire, amqp
+   }
+
+   private ClientLibraryType libraryType;
+
    private int noOfMessagesToSend = 1000;
 
    private int noOfWarmupMessages;
@@ -47,8 +53,6 @@ public class PerfParams implements Serializable {
 
    private boolean disableTimestamp;
 
-   private boolean openwire;
-
    private boolean dupsOK;
 
    private String uri;
@@ -158,10 +162,28 @@ public class PerfParams implements Serializable {
    }
 
    public boolean isOpenwire() {
-      return openwire;
+      return libraryType.equals(ClientLibraryType.openwire);
+   }
+
+   public boolean isAMQP() {
+      return libraryType.equals(ClientLibraryType.amqp);
+   }
+
+   public boolean isCore() {
+      return libraryType.equals(ClientLibraryType.core);
+   }
+
+   public ClientLibraryType getLibraryType() {
+      return libraryType;
    }
 
-   public void setOpenwire(boolean openwire) {
-      this.openwire = openwire;
+   public void setLibraryType(ClientLibraryType libraryType) {
+      this.libraryType = libraryType;
    }
+
+
+   public void setLibraryType(String libraryType) {
+      this.libraryType = ClientLibraryType.valueOf(libraryType);
+   }
+
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0354944e/examples/features/perf/perf/src/main/resources/perf.properties
----------------------------------------------------------------------
diff --git a/examples/features/perf/perf/src/main/resources/perf.properties b/examples/features/perf/perf/src/main/resources/perf.properties
index 7a0242a..db58fcd 100644
--- a/examples/features/perf/perf/src/main/resources/perf.properties
+++ b/examples/features/perf/perf/src/main/resources/perf.properties
@@ -15,17 +15,23 @@
 # specific language governing permissions and limitations
 # under the License.
 
-num-messages=25000
+num-messages=250000
 num-warmup-messages=1000
 message-size=1024
 durable=true
 transacted=false
-batch-size=1000
-drain-queue=false
-destination-name=perfQueue
+batch-size=100
+drain-queue=true
+destination-name=jms.queue.perfQueue
 throttle-rate=-1
 dups-ok-acknowledge=false
 disable-message-id=true
 disable-message-timestamp=true
-server-uri=tcp://localhost:61616
-openwire=false
+
+server-uri=amqp://localhost:61616
+#server-uri=tcp://localhost:61616
+
+#valid ones are openwire,core,amqp
+client-library=amqp
+#client-library=openwire
+#client-library=core


Mime
View raw message