performance tests on openwire
This commit is contained in:
parent
d3602200ae
commit
27b98a2514
|
@ -46,7 +46,8 @@ ${journal-buffer.settings}
|
|||
${connector-config.settings}
|
||||
<acceptors>
|
||||
<!-- Default ActiveMQ Artemis Acceptor. Multi-protocol adapter. Currently supports Core, OpenWire, Stomp and AMQP. -->
|
||||
<acceptor name="artemis">tcp://${host}:${default.port}</acceptor>
|
||||
<!-- performance tests have shown that openWire performs best with these buffer sizes -->
|
||||
<acceptor name="artemis">tcp://${host}:${default.port}?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576</acceptor>
|
||||
|
||||
<!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.-->
|
||||
<acceptor name="amqp">tcp://${host}:${amqp.port}?protocols=AMQP</acceptor>
|
||||
|
|
|
@ -194,9 +194,8 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor {
|
|||
@Override
|
||||
public void bufferReceived(Object connectionID, ActiveMQBuffer buffer) {
|
||||
try {
|
||||
Object object = wireFormat.unmarshal(buffer);
|
||||
Command command = (Command) wireFormat.unmarshal(buffer);
|
||||
|
||||
Command command = (Command) object;
|
||||
boolean responseRequired = command.isResponseRequired();
|
||||
int commandId = command.getCommandId();
|
||||
// the connection handles pings, negotiations directly.
|
||||
|
|
|
@ -18,7 +18,8 @@ specific language governing permissions and limitations
|
|||
under the License.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
|
@ -27,9 +28,9 @@ under the License.
|
|||
<version>1.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>perf</artifactId>
|
||||
<artifactId>openwire-perf</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>ActiveMQ Artemis JMS PerfExample Example</name>
|
||||
<name>ActiveMQ Artemis JMS Perf example for openwire</name>
|
||||
|
||||
<properties>
|
||||
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
|
||||
|
@ -37,33 +38,24 @@ under the License.
|
|||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jms_1.1_spec</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-jms-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<artifactId>activemq-client</artifactId>
|
||||
<version>${activemq5-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-nop</artifactId>
|
||||
<version>${slf4j-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- this is to have the ServerUtil -->
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-core-client</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-commons</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>${netty.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-jms-client</artifactId>
|
||||
<artifactId>artemis-cli</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -76,30 +68,37 @@ under the License.
|
|||
<plugin>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create</id>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>runClient</id>
|
||||
<goals>
|
||||
<goal>runClient</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<clientClass>org.apache.activemq.artemis.jms.example.Server</clientClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq.examples.soak</groupId>
|
||||
<artifactId>perf</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>create</id>
|
||||
<configuration>
|
||||
<noAutoTune>false</noAutoTune>
|
||||
<args>
|
||||
<arg>--queues</arg>
|
||||
<arg>perfQueue</arg>
|
||||
</args>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>runClient</id>
|
||||
<goals>
|
||||
<goal>runClient</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<clientClass>org.apache.activemq.artemis.jms.example.Server</clientClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq.examples.soak</groupId>
|
||||
<artifactId>openwire-perf</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -109,20 +108,26 @@ under the License.
|
|||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<id>runClient</id>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
<goal>runClient</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<clientClass>org.apache.activemq.artemis.jms.example.PerfListener</clientClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>org.apache.activemq.artemis.jms.example.PerfListener</mainClass>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq.examples.soak</groupId>
|
||||
<artifactId>openwire-perf</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
@ -132,25 +137,29 @@ under the License.
|
|||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.1</version>
|
||||
<groupId>org.apache.activemq</groupId>
|
||||
<artifactId>artemis-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<id>runClient</id>
|
||||
<goals>
|
||||
<goal>java</goal>
|
||||
<goal>runClient</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<clientClass>org.apache.activemq.artemis.jms.example.PerfSender</clientClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>org.apache.activemq.artemis.jms.example.PerfSender</mainClass>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.activemq.examples.soak</groupId>
|
||||
<artifactId>openwire-perf</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
@ -27,7 +27,6 @@ import javax.jms.MessageConsumer;
|
|||
import javax.jms.MessageListener;
|
||||
import javax.jms.MessageProducer;
|
||||
import javax.jms.Session;
|
||||
import javax.naming.InitialContext;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
@ -60,7 +59,7 @@ public abstract class PerfBase {
|
|||
protected static String getPerfFileName(final String[] args) {
|
||||
String fileName;
|
||||
|
||||
if (args.length > 0) {
|
||||
if (args != null && args.length > 0) {
|
||||
fileName = args[0];
|
||||
}
|
||||
else {
|
||||
|
@ -95,12 +94,13 @@ public abstract class PerfBase {
|
|||
boolean transacted = Boolean.valueOf(props.getProperty("transacted"));
|
||||
int batchSize = Integer.valueOf(props.getProperty("batch-size"));
|
||||
boolean drainQueue = Boolean.valueOf(props.getProperty("drain-queue"));
|
||||
String destinationLookup = props.getProperty("destination-lookup");
|
||||
String connectionFactoryLookup = props.getProperty("connection-factory-lookup");
|
||||
String destinationName = props.getProperty("destination-name");
|
||||
int throttleRate = Integer.valueOf(props.getProperty("throttle-rate"));
|
||||
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 uri = props.getProperty("server-uri", "tcp://localhost:61616");
|
||||
|
||||
PerfBase.log.info("num-messages: " + noOfMessages);
|
||||
PerfBase.log.info("num-warmup-messages: " + noOfWarmupMessages);
|
||||
|
@ -110,11 +110,12 @@ public abstract class PerfBase {
|
|||
PerfBase.log.info("batch-size: " + batchSize);
|
||||
PerfBase.log.info("drain-queue: " + drainQueue);
|
||||
PerfBase.log.info("throttle-rate: " + throttleRate);
|
||||
PerfBase.log.info("connection-factory-lookup: " + connectionFactoryLookup);
|
||||
PerfBase.log.info("destination-lookup: " + destinationLookup);
|
||||
PerfBase.log.info("destination-name: " + destinationName);
|
||||
PerfBase.log.info("disable-message-id: " + disableMessageID);
|
||||
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);
|
||||
|
||||
PerfParams perfParams = new PerfParams();
|
||||
perfParams.setNoOfMessagesToSend(noOfMessages);
|
||||
|
@ -124,12 +125,13 @@ public abstract class PerfBase {
|
|||
perfParams.setSessionTransacted(transacted);
|
||||
perfParams.setBatchSize(batchSize);
|
||||
perfParams.setDrainQueue(drainQueue);
|
||||
perfParams.setConnectionFactoryLookup(connectionFactoryLookup);
|
||||
perfParams.setDestinationLookup(destinationLookup);
|
||||
perfParams.setDestinationName(destinationName);
|
||||
perfParams.setThrottleRate(throttleRate);
|
||||
perfParams.setDisableMessageID(disableMessageID);
|
||||
perfParams.setDisableTimestamp(disableTimestamp);
|
||||
perfParams.setDupsOK(dupsOK);
|
||||
perfParams.setOpenwire(openwire);
|
||||
perfParams.setUri(uri);
|
||||
|
||||
return perfParams;
|
||||
}
|
||||
|
@ -151,17 +153,23 @@ public abstract class PerfBase {
|
|||
private long start;
|
||||
|
||||
private void init() throws Exception {
|
||||
InitialContext ic = new InitialContext();
|
||||
System.out.println("ic = " + ic);
|
||||
factory = (ConnectionFactory) ic.lookup(perfParams.getConnectionFactoryLookup());
|
||||
if (perfParams.isOpenwire()) {
|
||||
factory = new org.apache.activemq.ActiveMQConnectionFactory(perfParams.getUri());
|
||||
|
||||
destination = (Destination) ic.lookup(perfParams.getDestinationLookup());
|
||||
destination = new org.apache.activemq.command.ActiveMQQueue(perfParams.getDestinationName());
|
||||
|
||||
connection = factory.createConnection();
|
||||
connection = factory.createConnection();
|
||||
}
|
||||
else {
|
||||
factory = new org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory(perfParams.getUri());
|
||||
|
||||
destination = new org.apache.activemq.artemis.jms.client.ActiveMQQueue(perfParams.getDestinationName());
|
||||
|
||||
connection = factory.createConnection();
|
||||
|
||||
}
|
||||
|
||||
session = connection.createSession(perfParams.isSessionTransacted(), perfParams.isDupsOK() ? Session.DUPS_OK_ACKNOWLEDGE : Session.AUTO_ACKNOWLEDGE);
|
||||
|
||||
ic.close();
|
||||
}
|
||||
|
||||
private void displayAverage(final long numberOfMessages, final long start, final long end) {
|
||||
|
|
|
@ -39,9 +39,7 @@ public class PerfParams implements Serializable {
|
|||
|
||||
private boolean drainQueue = true;
|
||||
|
||||
private String connectionFactoryLookup;
|
||||
|
||||
private String destinationLookup;
|
||||
private String destinationName;
|
||||
|
||||
private int throttleRate;
|
||||
|
||||
|
@ -49,8 +47,20 @@ public class PerfParams implements Serializable {
|
|||
|
||||
private boolean disableTimestamp;
|
||||
|
||||
private boolean openwire;
|
||||
|
||||
private boolean dupsOK;
|
||||
|
||||
private String uri;
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
public synchronized int getNoOfMessagesToSend() {
|
||||
return noOfMessagesToSend;
|
||||
}
|
||||
|
@ -99,6 +109,14 @@ public class PerfParams implements Serializable {
|
|||
this.batchSize = batchSize;
|
||||
}
|
||||
|
||||
public String getDestinationName() {
|
||||
return destinationName;
|
||||
}
|
||||
|
||||
public void setDestinationName(String destinationName) {
|
||||
this.destinationName = destinationName;
|
||||
}
|
||||
|
||||
public synchronized boolean isDrainQueue() {
|
||||
return drainQueue;
|
||||
}
|
||||
|
@ -107,22 +125,6 @@ public class PerfParams implements Serializable {
|
|||
this.drainQueue = drainQueue;
|
||||
}
|
||||
|
||||
public synchronized String getConnectionFactoryLookup() {
|
||||
return connectionFactoryLookup;
|
||||
}
|
||||
|
||||
public synchronized void setConnectionFactoryLookup(final String connectionFactoryLookup) {
|
||||
this.connectionFactoryLookup = connectionFactoryLookup;
|
||||
}
|
||||
|
||||
public synchronized String getDestinationLookup() {
|
||||
return destinationLookup;
|
||||
}
|
||||
|
||||
public synchronized void setDestinationLookup(final String destinationLookup) {
|
||||
this.destinationLookup = destinationLookup;
|
||||
}
|
||||
|
||||
public synchronized int getThrottleRate() {
|
||||
return throttleRate;
|
||||
}
|
||||
|
@ -155,4 +157,11 @@ public class PerfParams implements Serializable {
|
|||
this.dupsOK = dupsOK;
|
||||
}
|
||||
|
||||
public boolean isOpenwire() {
|
||||
return openwire;
|
||||
}
|
||||
|
||||
public void setOpenwire(boolean openwire) {
|
||||
this.openwire = openwire;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
<?xml version='1.0'?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="urn:activemq"
|
||||
xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
|
||||
|
||||
<jms xmlns="urn:activemq:jms">
|
||||
<queue name="perfQueue"/>
|
||||
</jms>
|
||||
|
||||
<core xmlns="urn:activemq:core">
|
||||
|
||||
<security-enabled>false</security-enabled>
|
||||
<persistence-enabled>true</persistence-enabled>
|
||||
|
||||
<!-- Acceptors -->
|
||||
<acceptors>
|
||||
<acceptor name="netty-acceptor">tcp://localhost:61616?tcpNoDelay=false;tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576</acceptor>
|
||||
</acceptors>
|
||||
|
||||
<queues>
|
||||
<queue name="perfQueue">
|
||||
<address>perfAddress</address>
|
||||
</queue>
|
||||
</queues>
|
||||
|
||||
</core>
|
||||
</configuration>
|
|
@ -1,20 +0,0 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
java.naming.factory.initial=org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory
|
||||
connectionFactory.ConnectionFactory=tcp://localhost:61616?tcp-no-delay=false&tcp-send-buffer-size=1048576&tcp-receive-buffer-size=1048576
|
||||
queue.perfQueue=perfQueue
|
|
@ -15,16 +15,17 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
num-messages=100000
|
||||
num-messages=25000
|
||||
num-warmup-messages=1000
|
||||
message-size=1024
|
||||
durable=false
|
||||
durable=true
|
||||
transacted=false
|
||||
batch-size=1000
|
||||
drain-queue=false
|
||||
destination-lookup=perfQueue
|
||||
connection-factory-lookup=ConnectionFactory
|
||||
destination-name=perfQueue
|
||||
throttle-rate=-1
|
||||
dups-ok-acknowledge=false
|
||||
disable-message-id=true
|
||||
disable-message-timestamp=true
|
||||
server-uri=tcp://localhost:61616
|
||||
openwire=false
|
||||
|
|
|
@ -33,6 +33,8 @@ under the License.
|
|||
<name>ActiveMQ Artemis Examples</name>
|
||||
|
||||
<properties>
|
||||
<slf4j-version>1.7.10</slf4j-version>
|
||||
<activemq5-version>5.12.0</activemq5-version>
|
||||
<udp-address>231.7.7.7</udp-address>
|
||||
<activemq.basedir>${project.basedir}/..</activemq.basedir>
|
||||
</properties>
|
||||
|
|
Loading…
Reference in New Issue