Master Apache JMeter - From Load Testing to DevOps

Book description

Learn how to get the most out of JMeter, improve the productivity of your apps, and integrate JMeter with your Agile and DevOps processes.

Key Features

  • Gain insights into preparing test environments and selecting the correct use cases to load test
  • Learn to analyze a load test with Backend Listener, HTML Report Dashboard, and View Results Tree
  • Explore how to integrate JMeter in the software factory

Book Description

Load tests help identify the maximum number of requests a software system can handle. One popular open source tool for load testing is JMeter. By leveraging the features and capabilities of JMeter, you can perform extensive load testing and fix issues in your application before they become problematic.

This book is written by JMeter developers and begins by discussing the whole process, including recording a script, setting it up, and launching it, enabling you to almost immediately start load testing. You'll learn the best practices that you must follow while designing test cases. You'll also explore the different protocols offered by JMeter through various real-world examples. Finally, you'll see how to integrate JMeter into the DevOps approach and create professional reports. You'll discover ways to use the eco-system of JMeter to integrate new protocols, enrich its monitoring, and leverage its power through the use of the cloud.

By the end of this book, you'll know all that's needed to perform comprehensive load testing on your applications by using all the best practices and features of JMeter.

What you will learn

  • Explore various JMeter concepts, including Timers scope and Assertions scope
  • Discover the types of test protocols and load tests that JMeter supports
  • Design a realistic test scenario using various tips and best practices
  • Prepare your test environment with injectors and the system under test
  • Learn and apply good practices when recording a script
  • Integrate JMeter with Jenkins using Maven

Who this book is for

This book contains all the valuable information you need in one place and is a must for everybody who is seriously working with JMeter. It might be a little condensed for absolute beginners, but this book is the best you can find if you already have some performance testing experience and want to get further. In particular, it would be invaluable to developers who want to expand their JMeter knowledge into advanced topics or switch to JMeter from other load testing tools.

Table of contents

  1. Preface
    1. About the Book
      1. Preface by Alexander Podelko
      2. About the Authors
      3. About the Reviewer
      4. Learning Objectives
      5. Audience
      6. Approach
      7. Acknowledgment
      8. Copyright
  2. Chapter 1
  3. Quick Start with JMeter
    1. Our Process
    2. Setup JMeter to Record Our Browsing Session
    3. Configure Your Browser
    4. Save Our Script
    5. Validate Our Script with Only One User
    6. Setup Our Load Test and Launch It
    7. Run Our Load Test and Analyze It
  4. Chapter 2
  5. JMeter Overview
    1. JMeter Overview
    2. Types of Load Tests Supported
    3. Supported Test Protocols
    4. Reporting
  6. Chapter 3
  7. Designing a Test Case
    1. Introduction
    2. Warning
    3. Type of Load Test
      1. Performance/Load Test
      2. Stress Test
      3. Soak/Endurance Test
      4. Failover/Resilience Test
      5. Spike Test
      6. Other
    4. Load Model
      1. Concurrency User (Closed Model)
      2. Throughput (Open Model)
      3. Arrivals Rate (Open Model)
    5. Structure of a Test Case
      1. Ramp-Up
      2. Plateau/Step
      3. Ramp-Down
      4. Example: Step Load Test
    6. Identify Critical Business Scenarios to Script
      1. Frequent
      2. Vital
      3. Risky
    7. How Many Virtual Users Do I Need?
    8. Parameters to Take into Account when Creating a Scenario
      1. Vary User Input
      2. Reuse the Same Values
      3. Vary the Types of Users
      4. Vary and Adjust Think Times
      5. Adjust the Ramp-Up Time
      6. Adjust the Test Duration
      7. Error Handling
      8. User Connection Type
      9. Size of the Scenarios
      10. Meeting Point/Rendezvous
      11. Cookie Management
      12. Cache Management
    9. Conclusion
  8. Chapter 4
  9. Important Concepts in JMeter
    1. Scoping
    2. Elements' Execution Order
    3. How Timer Scope Works
      1. Rule 1: Timers Are Executed before Each Sampler in Their Scope
      2. Rule 2: If There Is More Than One Timer in the Scope, All the Timers Will Be Processed before the Sampler
      3. Controlling the Execution Order of Timers
    4. How Assertion Scope Works
      1. Rule 1: Assertions Are Executed after Each Sampler in Their Scope or to Parent Samplers
      2. Rule 2: Failed Assertions Cause the Failure of the Entire Transaction Controller
      3. Rule 3: Assertions Can Validate the Main Sample and/or the Sub-Samples
      4. Rule 4: Be Careful with Low-Performing Assertions
      5. Our Advice
    5. How Properties Differ from Variables
      1. How Properties Are Created
      2. How Variables Are Created
      3. How ${} Differs from ${_P}
  10. Chapter 5
  11. Preparing the Test Environment (Injectors and Tested Systems)
    1. Introduction
    2. Setting Up the Injectors
      1. Never Host Injectors on the Same Server as the Tested System
      2. Calibrating Your Test
      3. Monitoring Injectors
      4. IP Spoofing
      5. Using the Latest Version
      6. JMeter Memory Configuration
      7. Avoiding Load Testing behind a Proxy
    3. Preparation of the System under Test
      1. A Testing Environment
      2. An Environment Consistent with the Target
      3. Datasets
      4. Take into Account Calls to Third-Party Services
      5. Disabling Protection Systems
      6. Using Isolated Environments
      7. License Management
      8. Monitoring
    4. Conclusion
  12. Chapter 6
  13. Being Productive with JMeter
    1. Introduction
    2. Good Practices When Recording a Script
      1. Use the HTTP(S) Test Script Recorder Element
      2. BlazeMeter Chrome Extension
      3. Pre-Populating HTTP Request Defaults before Recording the Script
      4. Use Tools / Import from cURL
      5. Static Resources
      6. Using Timeouts
      7. Applying a Naming Convention to Transactions/Requests
      8. Global Assertion
      9. Reusing Script Parts
      10. Recording an HTTPS website
      11. Keyboard Shortcuts
    3. Debugging a script
      1. Using View Results Tree
      2. Capturing Errors
      3. Debug Sampler
      4. jp@gc - Dummy Sampler
      5. Log Viewer
      6. BlazeMeter's Step-by-Step Debugger
      7. The Old-Fashioned Way in the Console
      8. Using a Third-Party Tool
    4. Finalizing a Script
      1. Changing the Name of a Transaction According to a Parameter
      2. Sharing an Object between Different Thread Groups
      3. Getting the Most out of CSV Files
      4. Marking a Response as an Error
      5. Using a Regular Expression Extractor on Content with Spaces and Multiple Lines
      6. Executing an Action Based on the Status of the Previous One
      7. Adding Headers to Our HTTP Requests
      8. Waiting with While Controller
      9. The Right Extractor at the Right Time
      10. Handle Cookies
    5. Conclusion
  14. Chapter 7
  15. Load Testing a Website
    1. A Bit of Theory
    2. Setup with JMeter
    3. Methodology
    4. Put into Practice with JMeter
      1. Example 1: Simulate Realistic Load
      2. Example 2: Technical Tests with Byteman
      3. Example 3: Technical Tests with JProfiler
      4. Example 4: Tricking CAPTCHAs with a Java Request
    5. Conclusion
  16. Chapter 8
  17. Load Testing Web Services
    1. A Few Concepts
      1. REST (REpresentational State Transfer) Web Services
      2. WS-\* Web Services
    2. Setup with JMeter
    3. Methodology
    4. Practice with JMeter
      1. SOAP/XML-RPC Web Services
      2. REST Web Service: Discussion Forum
      3. REST Web Service: Customer Database
    5. Conclusion
  18. Chapter 9
  19. Load Testing a Database Server
    1. A Bit of Theory
    2. Methodology
    3. Setup with JMeter
    4. Putting Theory into Practice with JMeter
      1. Example 1: Load Test of a Database
      2. Example 2: Studying the Impact of Indexes on Performance
      3. Example 3: ETL
    5. Conclusion
  20. Chapter 10
  21. Load Testing Message-Oriented Middleware (MOM) via JMS
    1. A Bit of Theory
      1. Asynchronous Messages
      2. Decoupling
      3. Back Pressure
      4. Communication Models
      5. What is a Message Composed of?
    2. Setup with JMeter
      1. Installing the MOM libraries
      2. The JMS Point-to-Point Element
      3. JMS Resources and JNDI Properties
      4. Publish/Subscribe
    3. Methodology
    4. Putting It into Practice with JMeter
      1. Example 1: Testing the Configuration of an MOM server with Point-to-Point Messaging
      2. Example 2: Testing the Performance of Our Consumer with JMS Publish/Subscribe
      3. Example 3: Testing the Configuration of an MOM Server with Publish/Subscribe
      4. Example 4: Testing Any MOM
    5. Conclusion
  22. Chapter 11
  23. Performing a Load Test
    1. Introduction
    2. Methodology
    3. Testing Your Script with the Graphical User Interface
    4. Running Your Test from the Command Line
    5. Running Your Test on the Command Line with Taurus
    6. Running Your Test from Apache Maven
    7. Running Your Test from Jenkins
    8. Running Your Test from Apache Ant
    9. Best Practices
      1. Have Well-Prepared Injectors
      2. Generating Reports at the End of the Test
  24. Chapter 12
  25. Visualizing and Analyzing the Load Testing Results
    1. Introduction
    2. Visualizing the Results with Listeners
      1. View Results Tree
      2. Summary Report
      3. Aggregate Report
      4. Backend Listener
      5. Report Dashboard
      6. Particularities of the Visualization of Results a Distributed Load Test before JMeter 5.0
    3. Visualizing the Results with Third Party Visualizing Tools
    4. Visualizing the Results with PaaS Load Testing tools
      1. Redline13
      2. BlazeMeter
    5. Some Tips to Read the Results
      1. Prefer Percentiles over Average
      2. Be Careful with Downsampling and Data Retention
      3. Be Careful with Metric Definition
      4. Be Careful with Response Time at the Beginning of the Load Test
      5. Don't Rely on the Metrics of a Short Load Test
      6. Check Response Time Distribution
    6. Some Tips to Present the Results
      1. Don't Average Percentiles
      2. Define the Number of Metrics to Display in a Time Series Line Graph
      3. Define the Resolution/Granularity of the Measures
      4. Don't Forget to Add Labels, Legends, and Units in Graphs
      5. Axis Forced 0
      6. Don't Use Pie Charts
      7. Prefer Bar Graphs When We Have Sparse Metrics
      8. Present Errors with Toplist
      9. Time Series Graphs and Single-Value Summaries
    7. Conclusion
  26. Chapter 13
  27. Integration of JMeter in the DevOps Tool Chain
    1. Introduction
    2. Organization/Team Topology
      1. Load Testing Team in Its Ivory Tower
      2. DevOps and Load Test Team Collaboration
      3. One Performance Tester Integrated on DevOps Team
      4. No Performance Tester
      5. Team of Evangelists Performance Testers
    3. Setting Up Shift-Left Strategy
      1. Modification in JMeter Script to Implement Shift-Left Strategy
    4. Integrating JMeter in Our Software Factory
      1. Example 1: Integrating with Jenkins Using Maven
      2. Example 2: Enhancing Integration with Jenkins Using Performance Plugin
    5. Automation
      1. Example 3: Non-Regression Testing of Memory Consumption with EJ JProfiler
      2. Example 4: Detecting a Memory Leak during an Endurance Test with EJ JProfiler
      3. Example 5: Retrieving SQL Queries Executed during a Load Test with YourKit Java Profiler
      4. Example 6: Analysis of the Garbage Collector (GC) Log File with GCViewer
      5. Example 7: Non-Regression Testing of Web APIs with Dynatrace AppMon
    6. Conclusion

Product information

  • Title: Master Apache JMeter - From Load Testing to DevOps
  • Author(s): Antonio Gomes Rodrigues, Bruno Demion, Philippe Mouawad
  • Release date: August 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781839217647