blob: da4b7489b6bcad965b4ed697d9653f4a4621a930 [file] [log] [blame]
<div class="wiki-content maincontent"><h2>ActiveMQ Performance Module</h2>
<ul><li><link><page ri:content-title="ActiveMQ Performance Module Users Manual"></page><link-body>Users Manual</link-body></link></li></ul>
<h2>Example Testing Scenario</h2>
<p>This page gives a simple example of the kinds of thing we wanna do.</p>
<p>Assuming that all the test code is within a single Maven POM for now (e.g. activemq-integration-test version 4.0) which will deal with all the classpath issues.</p>
<p>We'll try describe the different ways this could work and give each implementation style a name so we can start revving different ways to solve this...</p>
<h3>Headless build</h3>
<p>In this version there is no 'controller'; each build is considered to be a totally separate build.</p>
<p>Each build knows what to do; each test case generates an XML file which becomes a named deployment artifact.</p>
<p>e.g. imagine the following builds (which are really just running Java executables within a POM for classpath)</p>
<table><tbody><tr><th colspan="1" rowspan="1"><p> Box </p></th><th colspan="1" rowspan="1"><p> Description </p></th><th colspan="1" rowspan="1"><p> Command line </p></th></tr><tr><td colspan="1" rowspan="1"><p> hostB </p></td><td colspan="1" rowspan="1"><p> Broker </p></td><td colspan="1" rowspan="1"><p> java org.apache.activemq.broker.console.Main tcp://$hostA:61616 </p></td></tr><tr><td colspan="1" rowspan="1"><p> hostC </p></td><td colspan="1" rowspan="1"><p> Consumer </p></td><td colspan="1" rowspan="1"><p> java org.apache.activemq.test.ConsumerMain --message-count=5000 --queue=true --destination=org.foo.bar tcp://$hostA:61616 </p></td></tr><tr><td colspan="1" rowspan="1"><p> hostD </p></td><td colspan="1" rowspan="1"><p> Producer </p></td><td colspan="1" rowspan="1"><p> java org.apache.activemq.test.ProducerMain --message-count=5000 --queue=true --destination=org.foo.bar tcp://$hostA:61616 </p></td></tr></tbody></table>
<p>In the above example - each build has to kinda wait for other things to start up to some time period. e.g. the producer and consumer wanna keep around for say 5 minutes trying to connect to the broker as they can be started in any order.</p>
<p>Ideally we might wanna run this as 3 maven commands as follows...</p>
<structured-macro ac:macro-id="38e63ecb-031a-4d14-af75-5f75f99487f0" ac:name="code" ac:schema-version="1"><plain-text-body>
mvn activemq:broker
mvn activemq:perf-producer -Dmessage-count=5000 -Dqueue=true -Ddestination=org.foo.bar -Durl=tcp://$hostA:61616
mvn activemq:perf-consumer -Dmessage-count=5000 -Dqueue=true -Ddestination=org.foo.bar -Durl=tcp://$hostA:61616
</plain-text-body></structured-macro>
<h3>Controller build</h3>
<p>The idea with the controller version is one of the tests (which is spun off first to try help) tries to coordinate among the test nodes.</p>
<p>e.g. we could spin the controller first...</p>
<table><tbody><tr><th colspan="1" rowspan="1"><p> Box </p></th><th colspan="1" rowspan="1"><p> Description </p></th><th colspan="1" rowspan="1"><p> Command line </p></th></tr><tr><td colspan="1" rowspan="1"><p> hostA </p></td><td colspan="1" rowspan="1"><p> Controller </p></td><td colspan="1" rowspan="1"><p> mvn test </p></td></tr></tbody></table>
<p>Then the test case fires off these processes while communicating with them...</p>
<table><tbody><tr><th colspan="1" rowspan="1"><p> Box </p></th><th colspan="1" rowspan="1"><p> Description </p></th><th colspan="1" rowspan="1"><p> Command line </p></th></tr><tr><td colspan="1" rowspan="1"><p> hostB </p></td><td colspan="1" rowspan="1"><p> Broker </p></td><td colspan="1" rowspan="1"><p> java org.apache.activemq.broker.console.Main tcp://$hostA:61616 </p></td></tr><tr><td colspan="1" rowspan="1"><p> hostC </p></td><td colspan="1" rowspan="1"><p> Consumer </p></td><td colspan="1" rowspan="1"><p> java org.apache.activemq.test.ConsumerMain --message-count=5000 --queue=true --destination=org.foo.bar tcp://$hostA:61616 </p></td></tr><tr><td colspan="1" rowspan="1"><p> hostD </p></td><td colspan="1" rowspan="1"><p> Producer </p></td><td colspan="1" rowspan="1"><p> java org.apache.activemq.test.ProducerMain --message-count=5000 --queue=true --destination=org.foo.bar tcp://$hostA:61616 </p></td></tr></tbody></table>
<h3>Controller factory build</h3>
<p>Fairly soon we're gonna have tons of builds firing off. We may want a single project to build with a raft of different test suites. Each single distributed integration/system/performance test might have many sub-builds (processes) to run.</p>
<p>So we might want to run a single JUnit test case which fires off different remote builds/processes.</p>
<p>e.g.</p>
<structured-macro ac:macro-id="e913d0b3-10e0-47da-bfd9-a0e44571b677" ac:name="code" ac:schema-version="1"><plain-text-body>
public class PerformanceTestSuite {
public void testSmallMessages() {
buildQueue.start("broker", "");
buildQueue.start("consumer", "--messageCount=1000");
buildQueue.start("producer", "--messageCount=1000");
buildQueue.join(5 * MINUTES);
}
public void testLargeMessages() {
buildQueue.start("broker", "");
buildQueue.start("consumer", "--messageCount=1000 --messageSize=1M");
buildQueue.start("producer", "--messageCount=1000 --messageSize=1M");
buildQueue.join(10 * MINUTES);
}
}
</plain-text-body></structured-macro>
<p>So these 2 test cases in JUnit in the controller build will each start 3 separate remote builds on the queue and wait for them to complete - or terminate them </p></div>