performance tests on openwire

This commit is contained in:
Clebert Suconic 2015-08-14 14:49:57 -04:00
parent d3602200ae
commit 27b98a2514
9 changed files with 136 additions and 173 deletions

View File

@ -46,7 +46,8 @@ ${journal-buffer.settings}
${connector-config.settings} ${connector-config.settings}
<acceptors> <acceptors>
<!-- Default ActiveMQ Artemis Acceptor. Multi-protocol adapter. Currently supports Core, OpenWire, Stomp and AMQP. --> <!-- 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.--> <!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.-->
<acceptor name="amqp">tcp://${host}:${amqp.port}?protocols=AMQP</acceptor> <acceptor name="amqp">tcp://${host}:${amqp.port}?protocols=AMQP</acceptor>

View File

@ -194,9 +194,8 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor {
@Override @Override
public void bufferReceived(Object connectionID, ActiveMQBuffer buffer) { public void bufferReceived(Object connectionID, ActiveMQBuffer buffer) {
try { try {
Object object = wireFormat.unmarshal(buffer); Command command = (Command) wireFormat.unmarshal(buffer);
Command command = (Command) object;
boolean responseRequired = command.isResponseRequired(); boolean responseRequired = command.isResponseRequired();
int commandId = command.getCommandId(); int commandId = command.getCommandId();
// the connection handles pings, negotiations directly. // the connection handles pings, negotiations directly.

View File

@ -18,7 +18,8 @@ specific language governing permissions and limitations
under the License. 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> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
@ -27,9 +28,9 @@ under the License.
<version>1.0.1-SNAPSHOT</version> <version>1.0.1-SNAPSHOT</version>
</parent> </parent>
<artifactId>perf</artifactId> <artifactId>openwire-perf</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>ActiveMQ Artemis JMS PerfExample Example</name> <name>ActiveMQ Artemis JMS Perf example for openwire</name>
<properties> <properties>
<activemq.basedir>${project.basedir}/../../../..</activemq.basedir> <activemq.basedir>${project.basedir}/../../../..</activemq.basedir>
@ -37,33 +38,24 @@ under the License.
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.geronimo.specs</groupId>
<artifactId>artemis-server</artifactId> <artifactId>geronimo-jms_1.1_spec</artifactId>
<version>${project.version}</version> <version>1.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-server</artifactId> <artifactId>activemq-client</artifactId>
<version>${project.version}</version> <version>${activemq5-version}</version>
</dependency> </dependency>
<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> <groupId>org.apache.activemq</groupId>
<artifactId>artemis-core-client</artifactId> <artifactId>artemis-cli</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>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
@ -76,30 +68,37 @@ under the License.
<plugin> <plugin>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>artemis-maven-plugin</artifactId> <artifactId>artemis-maven-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>create</id> <id>create</id>
<goals> <configuration>
<goal>create</goal> <noAutoTune>false</noAutoTune>
</goals> <args>
</execution> <arg>--queues</arg>
<execution> <arg>perfQueue</arg>
<id>runClient</id> </args>
<goals> </configuration>
<goal>runClient</goal> <goals>
</goals> <goal>create</goal>
<configuration> </goals>
<clientClass>org.apache.activemq.artemis.jms.example.Server</clientClass> </execution>
</configuration> <execution>
</execution> <id>runClient</id>
</executions> <goals>
<dependencies> <goal>runClient</goal>
<dependency> </goals>
<groupId>org.apache.activemq.examples.soak</groupId> <configuration>
<artifactId>perf</artifactId> <clientClass>org.apache.activemq.artemis.jms.example.Server</clientClass>
<version>${project.version}</version> </configuration>
</dependency> </execution>
</dependencies> </executions>
<dependencies>
<dependency>
<groupId>org.apache.activemq.examples.soak</groupId>
<artifactId>openwire-perf</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@ -109,20 +108,26 @@ under the License.
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>artemis-maven-plugin</artifactId>
<version>1.1</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <id>runClient</id>
<goals> <goals>
<goal>java</goal> <goal>runClient</goal>
</goals> </goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.PerfListener</clientClass>
</configuration>
</execution> </execution>
</executions> </executions>
<configuration> <dependencies>
<mainClass>org.apache.activemq.artemis.jms.example.PerfListener</mainClass> <dependency>
</configuration> <groupId>org.apache.activemq.examples.soak</groupId>
<artifactId>openwire-perf</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
@ -132,25 +137,29 @@ under the License.
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.apache.activemq</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>artemis-maven-plugin</artifactId>
<version>1.1</version>
<executions> <executions>
<execution> <execution>
<phase>package</phase> <id>runClient</id>
<goals> <goals>
<goal>java</goal> <goal>runClient</goal>
</goals> </goals>
<configuration>
<clientClass>org.apache.activemq.artemis.jms.example.PerfSender</clientClass>
</configuration>
</execution> </execution>
</executions> </executions>
<configuration> <dependencies>
<mainClass>org.apache.activemq.artemis.jms.example.PerfSender</mainClass> <dependency>
</configuration> <groupId>org.apache.activemq.examples.soak</groupId>
<artifactId>openwire-perf</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
</profile> </profile>
</profiles> </profiles>
</project> </project>

View File

@ -27,7 +27,6 @@ import javax.jms.MessageConsumer;
import javax.jms.MessageListener; import javax.jms.MessageListener;
import javax.jms.MessageProducer; import javax.jms.MessageProducer;
import javax.jms.Session; import javax.jms.Session;
import javax.naming.InitialContext;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
@ -60,7 +59,7 @@ public abstract class PerfBase {
protected static String getPerfFileName(final String[] args) { protected static String getPerfFileName(final String[] args) {
String fileName; String fileName;
if (args.length > 0) { if (args != null && args.length > 0) {
fileName = args[0]; fileName = args[0];
} }
else { else {
@ -95,12 +94,13 @@ public abstract class PerfBase {
boolean transacted = Boolean.valueOf(props.getProperty("transacted")); boolean transacted = Boolean.valueOf(props.getProperty("transacted"));
int batchSize = Integer.valueOf(props.getProperty("batch-size")); int batchSize = Integer.valueOf(props.getProperty("batch-size"));
boolean drainQueue = Boolean.valueOf(props.getProperty("drain-queue")); boolean drainQueue = Boolean.valueOf(props.getProperty("drain-queue"));
String destinationLookup = props.getProperty("destination-lookup"); String destinationName = props.getProperty("destination-name");
String connectionFactoryLookup = props.getProperty("connection-factory-lookup");
int throttleRate = Integer.valueOf(props.getProperty("throttle-rate")); int throttleRate = Integer.valueOf(props.getProperty("throttle-rate"));
boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege")); boolean dupsOK = Boolean.valueOf(props.getProperty("dups-ok-acknowlege"));
boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id")); boolean disableMessageID = Boolean.valueOf(props.getProperty("disable-message-id"));
boolean disableTimestamp = Boolean.valueOf(props.getProperty("disable-message-timestamp")); 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-messages: " + noOfMessages);
PerfBase.log.info("num-warmup-messages: " + noOfWarmupMessages); PerfBase.log.info("num-warmup-messages: " + noOfWarmupMessages);
@ -110,11 +110,12 @@ public abstract class PerfBase {
PerfBase.log.info("batch-size: " + batchSize); PerfBase.log.info("batch-size: " + batchSize);
PerfBase.log.info("drain-queue: " + drainQueue); PerfBase.log.info("drain-queue: " + drainQueue);
PerfBase.log.info("throttle-rate: " + throttleRate); PerfBase.log.info("throttle-rate: " + throttleRate);
PerfBase.log.info("connection-factory-lookup: " + connectionFactoryLookup); PerfBase.log.info("destination-name: " + destinationName);
PerfBase.log.info("destination-lookup: " + destinationLookup);
PerfBase.log.info("disable-message-id: " + disableMessageID); PerfBase.log.info("disable-message-id: " + disableMessageID);
PerfBase.log.info("disable-message-timestamp: " + disableTimestamp); PerfBase.log.info("disable-message-timestamp: " + disableTimestamp);
PerfBase.log.info("dups-ok-acknowledge: " + dupsOK); PerfBase.log.info("dups-ok-acknowledge: " + dupsOK);
PerfBase.log.info("server-uri: " + uri);
PerfBase.log.info("openwire:" + openwire);
PerfParams perfParams = new PerfParams(); PerfParams perfParams = new PerfParams();
perfParams.setNoOfMessagesToSend(noOfMessages); perfParams.setNoOfMessagesToSend(noOfMessages);
@ -124,12 +125,13 @@ public abstract class PerfBase {
perfParams.setSessionTransacted(transacted); perfParams.setSessionTransacted(transacted);
perfParams.setBatchSize(batchSize); perfParams.setBatchSize(batchSize);
perfParams.setDrainQueue(drainQueue); perfParams.setDrainQueue(drainQueue);
perfParams.setConnectionFactoryLookup(connectionFactoryLookup); perfParams.setDestinationName(destinationName);
perfParams.setDestinationLookup(destinationLookup);
perfParams.setThrottleRate(throttleRate); perfParams.setThrottleRate(throttleRate);
perfParams.setDisableMessageID(disableMessageID); perfParams.setDisableMessageID(disableMessageID);
perfParams.setDisableTimestamp(disableTimestamp); perfParams.setDisableTimestamp(disableTimestamp);
perfParams.setDupsOK(dupsOK); perfParams.setDupsOK(dupsOK);
perfParams.setOpenwire(openwire);
perfParams.setUri(uri);
return perfParams; return perfParams;
} }
@ -151,17 +153,23 @@ public abstract class PerfBase {
private long start; private long start;
private void init() throws Exception { private void init() throws Exception {
InitialContext ic = new InitialContext(); if (perfParams.isOpenwire()) {
System.out.println("ic = " + ic); factory = new org.apache.activemq.ActiveMQConnectionFactory(perfParams.getUri());
factory = (ConnectionFactory) ic.lookup(perfParams.getConnectionFactoryLookup());
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); 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) { private void displayAverage(final long numberOfMessages, final long start, final long end) {

View File

@ -39,9 +39,7 @@ public class PerfParams implements Serializable {
private boolean drainQueue = true; private boolean drainQueue = true;
private String connectionFactoryLookup; private String destinationName;
private String destinationLookup;
private int throttleRate; private int throttleRate;
@ -49,8 +47,20 @@ public class PerfParams implements Serializable {
private boolean disableTimestamp; private boolean disableTimestamp;
private boolean openwire;
private boolean dupsOK; private boolean dupsOK;
private String uri;
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public synchronized int getNoOfMessagesToSend() { public synchronized int getNoOfMessagesToSend() {
return noOfMessagesToSend; return noOfMessagesToSend;
} }
@ -99,6 +109,14 @@ public class PerfParams implements Serializable {
this.batchSize = batchSize; this.batchSize = batchSize;
} }
public String getDestinationName() {
return destinationName;
}
public void setDestinationName(String destinationName) {
this.destinationName = destinationName;
}
public synchronized boolean isDrainQueue() { public synchronized boolean isDrainQueue() {
return drainQueue; return drainQueue;
} }
@ -107,22 +125,6 @@ public class PerfParams implements Serializable {
this.drainQueue = drainQueue; 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() { public synchronized int getThrottleRate() {
return throttleRate; return throttleRate;
} }
@ -155,4 +157,11 @@ public class PerfParams implements Serializable {
this.dupsOK = dupsOK; this.dupsOK = dupsOK;
} }
public boolean isOpenwire() {
return openwire;
}
public void setOpenwire(boolean openwire) {
this.openwire = openwire;
}
} }

View File

@ -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>

View File

@ -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

View File

@ -15,16 +15,17 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
num-messages=100000 num-messages=25000
num-warmup-messages=1000 num-warmup-messages=1000
message-size=1024 message-size=1024
durable=false durable=true
transacted=false transacted=false
batch-size=1000 batch-size=1000
drain-queue=false drain-queue=false
destination-lookup=perfQueue destination-name=perfQueue
connection-factory-lookup=ConnectionFactory
throttle-rate=-1 throttle-rate=-1
dups-ok-acknowledge=false dups-ok-acknowledge=false
disable-message-id=true disable-message-id=true
disable-message-timestamp=true disable-message-timestamp=true
server-uri=tcp://localhost:61616
openwire=false

View File

@ -33,6 +33,8 @@ under the License.
<name>ActiveMQ Artemis Examples</name> <name>ActiveMQ Artemis Examples</name>
<properties> <properties>
<slf4j-version>1.7.10</slf4j-version>
<activemq5-version>5.12.0</activemq5-version>
<udp-address>231.7.7.7</udp-address> <udp-address>231.7.7.7</udp-address>
<activemq.basedir>${project.basedir}/..</activemq.basedir> <activemq.basedir>${project.basedir}/..</activemq.basedir>
</properties> </properties>