33
@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected] Learning JMeter in 60 Minutes

Learning j meter in 60 minutes

Embed Size (px)

DESCRIPTION

Learn how to use Apache JMeter in less than 60 minutes. The best open source tool to test API and performance of mobile and web applications

Citation preview

Page 1: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Learning JMeter in 60 Minutes

Page 2: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Alon Girmonsky About Me

•  Hands-On Developer for the Past 20 Years •  Expertise – Large-Scale Web and Mobile Applications –  IP & Internet

•  Founder & CEO of BlazeMeter – A Load Testing Platform as a Service – 100% Compatible with Apache JMeter

USERS

50,000

TESTS

500,000

Page 3: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Comprehensive scripting at your fingertips

Any Script, Any Scenario

•  HTTP / HTTPS •  Login / Signup •  Form POSTing / Credit card transactions •  Web services •  Parameters extraction •  Mobile •  MSSQL, Oracle SQL, MySQL •  Multiple user profiles

»  Any script »  Any scenario »  Any protocol

100% Apache JMeter Compatible

Page 4: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Download the Latest Release of JMeter

How to Install JMeter?

•  http://jmeter.apache.org/

Page 5: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The Thread Group

•  What is this? - A group of virtual users where each distinct user will follow a certain business process

The Thread Group Properties: Property Description No of Threads

The maximum number of threads that will run concurrently at the end of the ramp up period

Ramp up The period is will take the load to ramp up from “idle” to maximum load

Iterations The number of iteration each thread will execute

Duration The duration of the test from start to end

The Thread The sequence of events that comprise the simulated business process

Page 6: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The Thread Group

Page 7: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The Sampler

•  What is this? - The actual request object with its properties Supported Protocols: •  HTTP •  FTP •  LDAP •  MSSQL, MySQL, Oracle SQL •  Mongo DB •  SOAP/XML-RPC •  Generic

•  SMTP •  oAuth •  Rest •  TCP •  UDP •  Many many more

Page 8: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The Sampler

Page 9: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The Listener

•  What is this? - A fancy name for a report •  Type of Listeners

–  Aggregated –  Detailed

•  Use for debugging only •  Consume a lot of memory •  Use when you want to build custom reports (e.g. for errors only)

Page 10: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The Timer

•  What is this? - A fancy name for delay or think time Type of Timers: •  Constant •  Constant Throughput

dd

Page 11: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Timers belong to a scope- We need to understand this

The Timer

•  Timers (as other controllers/elements) work in scope •  Once put in scope, applies to every element in the scope •  If scope is of one element, applies only to that element Upper Scope

Child Scope

Page 12: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Record Using a Proxy

•  A good way to start a script •  Don’t forget to clean and parametrize

Page 13: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Record Using a Chrome Extension

Page 14: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Creating a Script Using a List of URLs

Page 15: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Necessary for Every Test

Test Defaults

Header

Page 16: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Getting your hands dirty with Apache JMeter

Practice: Writing Your First Script

Goal •  Create a test simulating a gradual ramp up of up to 10 users against these two

pages: –  http:// .. –  http:// ..

How to go about it: •  Use a proxy to record •  Clean and label •  Add the defaults •  Add listeners and delays •  Run •  Analyze the results

Page 17: Learning j meter in 60 minutes

175 Varick Street NY, NY 10013|1.855.445.2285|[email protected]

Advanced Scripting Concepts

Page 18: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Single Iteration

Single Iteration Vs Continuous Load

KPI: Number of Unique Users •  Simulate a ramp up of unique

users •  Low concurrency level For Example: •  I want only 25K users visiting my

website over 1 hour

Continuous KPI: Load Level •  Keep the load steady •  High concurrency level For Example: •  I want a constant and steady load

of 25K users visiting my website over 1 hour (I’ll probably end up with 200K users in that hour)

Page 19: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Assertions

•  Define Proprietary Errors •  Communicate Events

Page 20: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The best way to individualize each thread

Using CSV Files

Page 21: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

External Properties

•  Pass external properties to the script •  Customize same script to support various scenarios Methods •  Command line arguments (-J) •  Properties file: user.properties

Page 22: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Extract from a page and use for the next page

Parameter Extraction

Page 23: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Variables

Variables and Properties

•  Usage: ${var} •  Scope: unique per thread

Properties •  Usage: ${__P(prop)} •  Scope: Test •  Pass external properties to the

script •  Customize same script to support

various scenarios Methods •  Command line arguments (-J) •  Properties file: user.properties

Page 24: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The Debug Sampler

Debugging

•  The developer’s best friend

Page 25: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Getting your hands dirty with Apache JMeter

Practice: Writing Your Second Script

Goal •  Create a test simulating a gradual ramp up of up to 10 users logging in to:

–  http:// .. How to go about it: •  Use a proxy to record •  Use RexEx to parameterize •  Clean, label, add defaults, listeners and delays •  Add a CSV file with user names and passwords •  Use assertions to validate responses •  Run •  Analyze the results

Page 26: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Performance 1-on-1

Page 27: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

The Load Sensitivity Point What to look for?

Page 28: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Load Performance Types

Perfect Time

Sensitive

Bad

Page 29: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Load Performance Types

Perfect

The Perfect Load

Time

Page 30: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Load Performance Types

Sensitive

Sensitive to Load

Time

Page 31: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Load Performance Types

Bad

Bad Performance

Time

Page 32: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Load Performance Types

Perfect

Here They Are Again

Time

Sensitive

Bad

Page 33: Learning j meter in 60 minutes

@alongir 785 Castro Street, Mountain View, CA 94041|1.855.445.2285|[email protected]

Thank you for your time!

Jolt Awards 2013: The Best Testing Tools

Thank you for attending. We’ll send out an email with the recording and the deck.

Q & A For more information about Performance Testing and JMeter: http://BlazeMeter.com/blog/ [email protected] @BlazeMeter