This repository has been archived by the owner on Oct 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7adfa0
commit eac27cf
Showing
9 changed files
with
595 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
*.class | ||
*.log | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.ear | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
|
||
.idea | ||
*.iml | ||
*.ipr | ||
*.iws | ||
*.properties | ||
|
||
# generated files | ||
target | ||
results | ||
.ballerina | ||
/gen | ||
/compiler/ballerina-lang/src/main/resources/grammar/BallerinaLexer.tokens | ||
/tool-plugins/intellij/src/main/antlr/org/ballerinalang/plugins/idea/grammar/BallerinaLexer.tokens | ||
velocity.log | ||
|
||
# mac | ||
.DS_Store | ||
|
||
.classpath | ||
.project | ||
.settings | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><jmeterTestPlan jmeter="4.0 r1823414" properties="4.0" version="1.2"> | ||
<hashTree> | ||
<TestPlan enabled="true" guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan"> | ||
<stringProp name="TestPlan.comments"/> | ||
<boolProp name="TestPlan.functional_mode">false</boolProp> | ||
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp> | ||
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp> | ||
<elementProp elementType="Arguments" enabled="true" guiclass="ArgumentsPanel" name="TestPlan.user_defined_variables" testclass="Arguments" testname="User Defined Variables"> | ||
<collectionProp name="Arguments.arguments"/> | ||
</elementProp> | ||
<stringProp name="TestPlan.user_define_classpath"/> | ||
</TestPlan> | ||
<hashTree> | ||
<ThreadGroup enabled="true" guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="JMS publisher"> | ||
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp> | ||
<elementProp elementType="LoopController" enabled="true" guiclass="LoopControlPanel" name="ThreadGroup.main_controller" testclass="LoopController" testname="Loop Controller"> | ||
<boolProp name="LoopController.continue_forever">false</boolProp> | ||
<stringProp name="LoopController.loops">10000</stringProp> | ||
</elementProp> | ||
<stringProp name="ThreadGroup.num_threads">1</stringProp> | ||
<stringProp name="ThreadGroup.ramp_time">0</stringProp> | ||
<boolProp name="ThreadGroup.scheduler">false</boolProp> | ||
<stringProp name="ThreadGroup.duration"/> | ||
<stringProp name="ThreadGroup.delay"/> | ||
</ThreadGroup> | ||
<hashTree> | ||
<PublisherSampler enabled="true" guiclass="JMSPublisherGui" testclass="PublisherSampler" testname="JMS Publisher"> | ||
<stringProp name="jms.jndi_properties">false</stringProp> | ||
<stringProp name="jms.initial_context_factory">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</stringProp> | ||
<stringProp name="jms.provider_url">/home/hasithaj/Desktop/jndi.properties</stringProp> | ||
<stringProp name="jms.connection_factory">QueueConnectionFactory</stringProp> | ||
<stringProp name="jms.topic">QueueName</stringProp> | ||
<stringProp name="jms.expiration"/> | ||
<stringProp name="jms_error_reconnect_on_codes"/> | ||
<stringProp name="jms.priority"/> | ||
<stringProp name="jms.security_principle"/> | ||
<stringProp name="jms.security_credentials"/> | ||
<stringProp name="jms.text_message">Testing Performance</stringProp> | ||
<stringProp name="jms.input_file"/> | ||
<stringProp name="jms.random_path"/> | ||
<stringProp name="jms.config_choice">jms_use_text</stringProp> | ||
<stringProp name="jms.config_msg_type">jms_text_message</stringProp> | ||
<stringProp name="jms.iterations">1</stringProp> | ||
<boolProp name="jms.authenticate">false</boolProp> | ||
<elementProp elementType="JMSProperties" name="jms.jmsProperties"> | ||
<collectionProp name="JMSProperties.properties"/> | ||
</elementProp> | ||
</PublisherSampler> | ||
<hashTree/> | ||
<kg.apc.jmeter.timers.VariableThroughputTimer enabled="true" guiclass="kg.apc.jmeter.timers.VariableThroughputTimerGui" testclass="kg.apc.jmeter.timers.VariableThroughputTimer" testname="jp@gc - Throughput Shaping Timer"> | ||
<collectionProp name="load_profile"> | ||
<collectionProp name="1859234101"> | ||
<stringProp name="53">5</stringProp> | ||
<stringProp name="1000">1000</stringProp> | ||
<stringProp name="60">60</stringProp> | ||
</collectionProp> | ||
</collectionProp> | ||
</kg.apc.jmeter.timers.VariableThroughputTimer> | ||
<hashTree/> | ||
</hashTree> | ||
</hashTree> | ||
</hashTree> | ||
</jmeterTestPlan> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Performance testing tool for ballerina-message-broker | ||
|
||
This tool allows ballerina message broker developers to get an idea about the performance of the message broker after a modification is done in the code.Following criteria is going to be used in evaluating the performance. | ||
|
||
- Connection Load - The number of message producers, or message consumers, or the number of concurrent connections a system can support. | ||
- Message throughput - The number of messages or message bytes that can be pumped through a messaging system per second. | ||
- Latency - The time it takes a particular message to be delivered from message producer to message consumer. | ||
|
||
## How to use | ||
|
||
1.Copy following jars to JMETER_HOME/lib. | ||
|
||
- andes-client-0.13.wso2v8.jar | ||
- geronimo-jms_1.1_spec-1.1.0.wso2v1.jar | ||
- slf4j-1.5.10.wso2v1.jar | ||
|
||
2.Create jndi.properties file | ||
|
||
```properties | ||
# register some connection factories | ||
# connectionfactory.[jndiname] = [ConnectionURL] | ||
connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:<port>' | ||
|
||
# register some queues in JNDI using the form | ||
# queue.[jndiName] = [physicalName] | ||
queue.QueueName = <queue_name> | ||
``` | ||
3.Create a testplan.properties files including following results. | ||
```properties | ||
jndi_file= <jndi_file_location> | ||
loop_count = <number_of_loops> | ||
thread_count = <number_of_threads> | ||
ramp_time = <ramp_time> | ||
jmeter_home = <jmeter_home>/jmeter | ||
|
||
``` | ||
4.Run ```mvn clean install``` on the project and obtain the ```performance-testing-tool-1.0-SNAPSHOT-jar-with-dependencies.jar```.<br><br> | ||
5.Execute the jar using ```java -jar performance-testing-tool-1.0-SNAPSHOT-jar-with-dependencies.jar -p <testplan.properties file location>``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2005-2011, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
~ | ||
~ WSO2 Inc. 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. | ||
--> | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.wso2.testing</groupId> | ||
<artifactId>performance-testing-tool</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<commons.cli.version>1.2</commons.cli.version> | ||
<log4j.version>1.2.17</log4j.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>commons-cli</groupId> | ||
<artifactId>commons-cli</artifactId> | ||
<version>${commons.cli.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>${log4j.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass> | ||
org.wso2.brokerperformancetester.A | ||
</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
77 changes: 77 additions & 0 deletions
77
tools/src/main/java/org/wso2/brokerperformancetester/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. 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. | ||
* | ||
*/ | ||
|
||
package org.wso2.brokerperformancetester; | ||
|
||
import org.apache.commons.cli.BasicParser; | ||
import org.apache.commons.cli.CommandLine; | ||
import org.apache.commons.cli.CommandLineParser; | ||
import org.apache.commons.cli.Options; | ||
import org.apache.commons.cli.ParseException; | ||
import org.apache.log4j.Logger; | ||
import org.wso2.brokerperformancetester.Utils.ToolConfiguration; | ||
import org.wso2.brokerperformancetester.Utils.XMLUtils; | ||
|
||
import java.io.BufferedReader; | ||
import java.io.IOException; | ||
import java.io.InputStreamReader; | ||
|
||
/** | ||
* Provide cli interface to create | ||
*/ | ||
public class Application { | ||
|
||
private static final Logger log = Logger.getLogger(Application.class); | ||
|
||
public static void main(String[] args) { | ||
|
||
Options options = new Options(); | ||
options.addOption("p", "properties", true, "Properties file to create the test plan."); | ||
CommandLineParser parser = new BasicParser(); | ||
try { | ||
CommandLine cmd = parser.parse(options, args); | ||
if (cmd.hasOption("p")) { | ||
log.info("Using cli argument -p=" + cmd.getOptionValue("p")); | ||
ToolConfiguration toolConfiguration = new ToolConfiguration(cmd.getOptionValue("p")); | ||
String jndiPath = toolConfiguration.getJndiPropertyPath(); | ||
if (jndiPath == null) { | ||
log.error("Jndi properties file should be provided to run the tool."); | ||
} else { | ||
int loopCount = toolConfiguration.getLoopCount(); | ||
int threadCount = toolConfiguration.getThreadCount(); | ||
int rampTime = toolConfiguration.getRampTime(); | ||
new XMLUtils(jndiPath, loopCount, threadCount, rampTime).generateTestPlan(); | ||
String jmeterCommand = toolConfiguration.getJmeterHome() + " -n -t JmsPublisher.jmx"; | ||
Process jmeterProcess = Runtime.getRuntime().exec(jmeterCommand); | ||
BufferedReader processOutput = new BufferedReader(new InputStreamReader(jmeterProcess.getInputStream())); | ||
String output; | ||
while ((output = processOutput.readLine()) != null) { | ||
log.info(output); | ||
} | ||
} | ||
} else { | ||
log.error("Missing -p option"); | ||
} | ||
} catch (ParseException parseException) { | ||
log.error("Failed to parse comand line properties " + parseException.getMessage()); | ||
} catch (IOException ioEx) { | ||
log.error("Error occured while executing jmeter " + ioEx.getMessage()); | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
tools/src/main/java/org/wso2/brokerperformancetester/Utils/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. 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. | ||
* | ||
*/ | ||
|
||
package org.wso2.brokerperformancetester.Utils; | ||
|
||
/** | ||
* Constants need to execute the Application | ||
*/ | ||
public class Constants { | ||
// x-paths | ||
public static final String XPATH_THREAD_GROUP = "/jmeterTestPlan/hashTree/hashTree/ThreadGroup"; | ||
public static final String XPATH_PUBLISHER_SAMPLER = "/jmeterTestPlan/hashTree/hashTree/hashTree/PublisherSampler"; | ||
|
||
// file path | ||
public static final String FILE_PATH = "JmsPublisher.jmx"; | ||
|
||
// properties file constants | ||
public static final String JNDI_PROPERTY_FILE_LOCATION = "jndi_file"; | ||
public static final String LOOP_COUNT = "loop_count"; | ||
public static final String THREAD_COUNT = "thread_count"; | ||
public static final String RAMP_TIME = "ramp_time"; | ||
public static final String JMETER_HOME = "jmeter_home"; | ||
|
||
// xml tag constants | ||
public static final String XML_STRING_PROP = "stringProp"; | ||
public static final String XML_ELEMENT_PROP = "elementProp"; | ||
public static final String XML_NAME = "name"; | ||
public static final String XML_JMS_PROVIDER_URL = "jms.provider_url"; | ||
public static final String XML_NO_OF_THREADS = "ThreadGroup.num_threads"; | ||
public static final String XML_RAMP_TIME = "ThreadGroup.ramp_time"; | ||
|
||
} |
Oops, something went wrong.