DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Data Engineering
  3. Data
  4. Performance Testing With JMeter

Performance Testing With JMeter

Learn about how to test the performance of your application with JMeter, including a step-by-step guide with screenshots!

Zoe De Roeck user avatar by
Zoe De Roeck
·
Dec. 30, 19 · Tutorial
Like (0)
Save
Tweet
Share
2.09K Views

Join the DZone community and get the full member experience.

Join For Free

person holding a leather bag

Learn how to test your app's performance!

Can Your App Handle the Load?

When developing complex, high-availability software projects, performance is of key importance. That is especially true in these modern times where anything other than lightning-fast accessibility of real-time data is punished. This is not always an easy feat when talking about the huge amounts of data that are sometimes required.

In this post, we’ll use an online booking engine as the guiding example. All data comes from a single API. We’ll map the expected bottlenecks, set up realistic scenarios on the expected load, and automate all of this so we can check the performance the whole time. We’ll do this using JMeter and BlazeMeter.

You may also like: JMeter Tutorial for Beginners

Analysis

All the load on the API can be put into one of three categories. There are API calls from our booking engine. Then the automated jobs that have an impact on our system resources. These are triggered with an API endpoint as well. Finally, we look at the API calls that tax the server independently of the booking engine. It is important, in other words, to chart all factors that impact the server resources, as it is not just the booking engine that is responsible for the load.

We use Google Analytics to check the current page-views-per-API-method. The busiest day of the year is the basis for the load. If you expect a certain amount of growth, you can always multiply this with a certain factor.

We also look at the division between API-calls between the booking engine and automated tasks on the one hand and other calls. This is best done over an entire year. The result of all this should be something like the following.

API-CALL

AMOUNT

PERCENTAGE

PART

/available-days

5k

31%

BOOKING ENGINE

/available -hours

4k

15%

BOOKING ENGINE

...

/recalculate-event

1k

16%

TASKS

...

/get-employees

2k

5%

OTHER

...

JMeter

We use JMeter to write our performance tests. To create realistic JMeter scenarios from this data, we use two additional plugins:

  • Weighted Switch Controller, to get the necessary requests.
  • Random CSV Data Set, to use random parameters from a CSV list for the API calls.

In the end, the scenario’s look like this:

A JMeter scenario

There are three repeating parts of the scenario. Some important aspects:

  1. Loading up random restaurant IDs with the Random CSV Data Set plugin to create API requests for the different restaurants.
  2. Completing a booking via the engine consists of several sequential steps. We call on these steps using the random data from the CSV set together with JMeter functions.

Putting random data in the steps

The Regular Expression Extractor saves the API response in a variable for the next steps.

Saving the API response as a variable

3. The IF controller makes sure the next steps are only started when a certain condition is met. If not, JMeter starts the next test cycle, where we check the availability for the random data that was given. A Jexl2 expression is used to check whether the variable is not null:

Checking whether the variable is null

4. In this last step, we use the Response Assertion to check the response. If it does not contain the word ‘success’, JMeter goes to the next test cycle:

Response must contain 'success'











5. The Weighted Switch Controller is used to launch the automated tasks and the other API calls with a weighted average. We use the percentages from our analysis for this.

Each group requires a set number of users. Depending on your analysis and the expected load, select an amount that makes sense.

BlazeMeter

BlazeMeter is a great tool to run JMeter tests. After you upload your scenarios, plugins and data CSV, you can configure your load with the number of concurrent users, time to complete and ramp-up. The most important factor is the number of users.

This amount will be spread out evenly over the different groups, based on the number of users set in JMeter. The amount should be such that you produce at least your expected load. Finally, BlazeMeter also allows you to select the origin of your traffic. Its free plan allows you to run one such plan per week.

Configuring your BlazeMeter scenario

It is also possible to select failure criteria, based on your KPIs.

Selecting failure criteria

BlazeMeter allows integrations with different monitoring and CI tools; we use Bamboo. There is a Bamboo plugin and a comprehensive guide to help you with the integration.

This way you can run automated performance tests once a week (more often if you upgrade your BlazeMeter subscription). These tests generate reports with a detailed overview of the responses and errors per request.

Conclusion

Getting your analysis right is perhaps the most important part of writing performance tests. This means getting not just the expected load from the application itself, but also the other API calls and other tasks that influence performance. That data is used to create the JMeter scenarios; the Random Data and Weighted Controller plugins are a great help here. BlazeMeter lets you run these scenarios and creates visual reports to help you find your bottlenecks and problems. Integration with your CI system is a boon here.

Performance testing is an invaluable tool. The combination of JMeter with BlazeMeter allows us to weed out bottlenecks and issues regularly and consistently. So each build is as fast as we can make it.


Further Reading

Database Load Testing With JMeter

JMeter Tutorials: Test Better, Build Better

Step-by-Step Load Testing Guide: JMeter

Data (computing) API Testing Engine

Published at DZone with permission of Zoe De Roeck. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • A Deep Dive Into AIOps and MLOps
  • An End-to-End Guide to Vue.js Testing
  • Fargate vs. Lambda: The Battle of the Future
  • Accelerating Enterprise Software Delivery Through Automated Release Processes in Scaled Agile Framework (SAFe)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: