Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing...

34
Automated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett

Transcript of Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing...

Page 1: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

Automated performance testing

using Maven & JMeter

George Barnett, Atlassian Software Systems@georgebarnett

Page 2: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

• Create controllable JMeter tests

• Configure Maven to create a repeatable cycle

• Run this “build” in your CI server every 8 hours

• Find performance regressions faster

Page 3: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

WHY?

• Catch regressions quickly

• Stop hunting for bugs

• Code with confidence

• Know the performance cost of features

• Fearless external dependency upgrades

• Go home on time

Page 4: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

ATLASSIAN

• 15,000+ customers

• 100+ developers

• 8 software streams

• 1 performance engineer

Page 5: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

ATLASSIAN

• JIRA - Issue management

• Confluence - Enterprise Wiki

• Bamboo - Continuous Integration

• FishEye, Crucible & Clover - Dev Tools

• Crowd - Single Sign-On.

Page 6: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

BEFORE WE BEGIN

• Continuous Integration is critical

• Keep code working with Unit and Functional tests

• Broken or irregular builds means no code to performance test

• Performance testing is NOT a replacement for other testing (but it helps)

Page 7: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

PROCESS

• Write code (1-6 months)

• Compile code

• Send it to QA (or Production?!)

• Performance Regression

• PANIC!

No performance testing!

Page 8: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

A BETTER WAY

• Write code

• CI compiles code and runs tests

• Send it to QA (or Production?!)

• Performance Regression

• PANIC!

No performance testing!

Page 9: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

A BETTER WAY 2.0

• Performance test artifacts as soon as they pass Unit and Functional testing

• Fast feedback for developers

• No Surprises

Page 10: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

TOOLS

• JMeter

• Maven & plugins

• Bamboo & plugins

• A Profiler

Page 11: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

JMETER

• Apache Project

• Java

• Supports HTTP, JDBC, SOAP, XML-RPC, FTP, SMTP, LDAP, JUnit & more.

Page 12: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •
Page 13: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

MAVEN

• Apache Project

• Java

• Build Tool

• Dependency management

• Documentation

Page 14: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

MAVEN CONCEPTS

• Project Object Model (POM)

• Standardised directory structure

• Build Lifecycle

• Reporting Lifecycle

• Plugins

Page 15: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

MAVEN POM<project> <groupid>com.atlassian.com.performance.jira</groupid> <artifactid>automated-performance</artifactid>

<properties> <test.dataset>/opt/dataset/dataset1.zip</test.dataset> </properties>

<build> <!--Main Lifecycle plugins configured here--> </build>

<reporting> <!--Reporting Lifecycle here--> </reporting></project>

Page 16: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

MAVEN PLUGINS

• Chronos

• Ant-run

• Cargo

• Maven Assembly plugin

• Maven Dependency plugin

Page 17: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

BAMBOO

• Continuous Integration

• Can run builds on Amazon’s EC2

• JMeter Aggregator Plugin

Page 18: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

A PROFILER

• Java Profiler

• CPU Snapshots

• GC & Memory information

• Thread usage and contention

• Triggers & offline sampling

Page 19: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

STEP 1

• Maven Assembly plugin

• Create a .zip from project directories

• `mvn deploy` to repository as a SNAPSHOT

Package the JMeter test

Page 20: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

• Package application state into zip files

• Ant-run - application pre-setup

• Cargo - deploy container

• Chronos - configure the JMeter tests

STEP 2Configure the Maven automated build

Page 21: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

MAVEN PROFILES<project> .. <properties> <test.dataset>/opt/dataset/dataset1.zip</test.dataset> </properties>

<profile> <id>dataset1</id> <properties> <test.dataset>/opt/dataset/dataset1.zip</test.dataset> ..

<profile> <id>dataset2</id> <properties> <test.dataset>/opt/dataset/dataset2.zip</test.dataset> ..

Page 22: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

MAVEN PROFILES• Invoked on command line

• eg: mvn verify -Pmysql, tomcat5, dataset1

• Configuration in profile is added to build

• Use for a wider variation in test environments

• Use profiles for individual “work units”, eg JMeter

Page 23: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

ADDING A PROFILER

<global.jvm.args>-Xms2000m -Xloggc:${project.build.directory}/gc.log</global.jvm.args><jvm.args>${global.jvm.args}</jvm.args>

<profile> <id>jprofiler</id> <properties>

<jvm.args>-agentlib:jprofilerti=offline,id=${jprofiler.profileid},config=${jprofiler.configfile} -Xbootclasspath/a:${jprofiler.home}/bin/agent.jar ${global.jvm.args}</jvm.args>

</properties></profile>

$ export LD_LIBRARY_PATH=”$JPHOME/bin/linux-x64/

Page 24: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTING

• Available in maven

• eg: mvn site / mvn chronos:report

• Generates graphs and a numerical report

• Can compare to historical data

• Static :(

CHRONOS

Page 25: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTINGCHRONOS

Page 26: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTINGCHRONOS

Page 27: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTINGCHRONOS

Page 28: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTINGCHRONOS

Page 29: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTINGCHRONOS - HISTORY

Page 30: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTINGCHRONOS - HISTORY

Page 31: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTING

• Open source Bamboo plugin (supported!)

• James Roper (Atlassian) 20% time project

• Can graph JMeter .JTL and CSV files

• Dynamic

BAMBOO JMETER AGGREGATOR

Page 32: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

REPORTINGBAMBOO JMETER AGGREGATOR

Page 33: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

TIPS

• Allocate time for fixing tests

• Your tests WILL break

• Work out a process for fixing bugs

• Gather as many artifacts from each test run as possible

• React sooner rather than later

Page 34: Automated performance testing using Maven & JMeter · PDF fileAutomated performance testing using Maven & JMeter George Barnett, Atlassian Software Systems @georgebarnett •

Q&Agbarnett @ atlassian . com

@georgebarnett

Code samples online soon!blogs.atlassian.com/developer

Meet Atlassian @ The Summit:May 31 - June 2 in SF

www.atlassian.com/summit