jenkins the definitive guide

(Jeff_L) #1

This graph gives you an overview of performance over time. You would typically use this graph to
ensure that your average response times are within the expected limits, and also spot any unusually
high variations in the average or maximum response times. However if you need to track down and
isolate performance issues, the Performance Breakdown screen can be more useful. From within the
Performance Trend report, click on the Last Report link at the top of the screen. This will display a
breakdown of response times and errors per request (see Figure 6.30, “You can also view performance
results per request”). You can do the same thing for previous builds, by clicking on the Performance
Report link in the build details page.


With some minor variations, a JMeter test script basically works by simulating a given number of
simultaneous users. Typically, however, you will want to see how your application performs for different
numbers of users. The Jenkins Performance plugin handles this quite well, and can process graphs for
multiple JMeter reports. Just make sure you use a wildcard expression when you tell Jenkins where to
find the reports.


Of course, it would be nice to be able to reuse the same JMeter test script for each test run. JMeter
supports parameters, so you can easily reuse the same JMeter script with different numbers of simulated
users. You just use a property expression in your JMeter script, and then pass the property to JMeter when
you run the script. If your property is called request.threads, then the property expression in your
JMeter script would be ${__property(request.threads)}. Then, you can use the
element in the Ant task to pass the property when you run the script. The following Ant
target, for example, runs JMeter three times, for 200, 500 and 1000 simultaneous users:


<target name="jmeter">
<jmeter jmeterhome="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/tools/jmeter"
testplan="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/src/test/jmeter/gameoflife.jmx"
resultlog="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/target/jmeter-results-200-users.jtl">
<jvmarg value="-Xmx512m" />
<property name="request.threads" value="200"/>
<property name="request.loop" value="20"/>
</jmeter>
<jmeter jmeterhome="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/tools/jmeter"
testplan="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/src/test/jmeter/gameoflife.jmx"
resultlog="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/target/jmeter-results-500-users.jtl">
<jvmarg value="-Xmx512m" />
<property name="request.threads" value="500"/>
<property name="request.loop" value="20"/>
</jmeter>
<jmeter jmeterhome="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/tools/jmeter"
testplan="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/src/test/jmeter/gameoflife.jmx"
resultlog="/Users/johnsmart/Projects/Books/jenkins-the-definitive-guide/hudsonbook-content/target/jmeter-results-1000-users.jtl">
<jvmarg value="-Xmx512m" />
<property name="request.threads" value="1000"/>
<property name="request.loop" value="20"/>
</jmeter>
</target>
Free download pdf