JMeter Load Testing

Load testing with Apache JMeter

Load Testing Using JMeter

If your organization has not historically performed load tests on your websites, web applications, or APIs, you may not only be risking performance issues and poor user experience, you may encounter issues getting room in the budget for a load testing solution. Using open-source solutions, such as Apache JMeter, Taurus, Gatling, and others, will look good to management, as open-source solutions are typically free to use and there are no upfront investments, however that does not mean there are no costs involved. Open-source tools come with some drawbacks, and less functionality, compared to a commercial solution such as LoadView.

For this article, we will take a high-level look into JMeter and some of the considerations that come with using this load testing tool. Just keep in mind that JMeter can only run protocol-based tests and does not render any JavaScript, HTML, or CSS, which may not be enough for understanding performance at the user level.

JMeter Load Testing with LoadView

Overcome Your JMeter Load Testing Limitations with LoadView

Remember, load testing is not the same as stress testing. You are not trying to break your website, web app, or API. You are trying to understand how your target, and underlying system, behaves when applied with heavy number of concurrent users, or traffic. For example, a website that slows down on the day of a big product launch could do irreparable damage to the business (and customer loyalty), so load test as thoroughly as JMeter allows.

 

JMeter: Getting Started

Apache JMeter will run on any operating system that supports Java 6 or later. You will also need to install Oracle Java or OpenJDK. JMeter has a fairly intuitive GUI interface.

 

Creating the Test Plan

You will see a Test Plan icon on the left side of the JMeter window. Right-click it and select Add > Threads (Users) > Thread Group. This brings up the Thread Group Control Panel where you can specify the number of users for your load test (Number of Threads), the amount of time you want to spend ramping up to the full number of users (Ramp-Up Period), and the number of times each user should perform the test scripts (Loop Count).

Make sure the number of users reflects the amount of traffic you expect on a busy day, such as Black Friday.

Once you have created a Thread Group, it should appear in the tree underneath the Test Plan. Now you need to add HTTP Request Defaults. Right-click the Thread Group icon and select Add > Config Element > HTTP Request Defaults. Enter the URL of your website in the control panel.

 

Recording Test Scripts

You will want to record test scripts that mimic actual user behavior, such as putting items in a shopping cart and checking out. Open a web browser, such as Firefox or Chrome, and change the browser’s Network Preferences to use JMeter’s proxy. Select Manual Proxy Configuration and enter “localhost” for Address and “8888” for the Port.

Now you’re ready to start recording a test script. Type the URL of your website in the browser’s address bar and hit Enter. From your site’s home page, click on a few links and navigate like an actual user would. Close the browser and return to JMeter. Expand the Thread Group tree and verify that there are now several samplers under the Thread Group. These are the different pages you navigated to when recording your script.

Save your test plan and validate the script by right clicking on Thread Group and selecting Validate. Click on the View Results icon under the Thread Group to see if validation was successful.

 

Run the Load Test

Click the Run icon on JMeter’s toolbar to start the load test. JMeter will display the test results in a graph updated in real-time.

 

Analyze the Load Test Results

JMeter displays Throughput on the graph in green. The higher the throughput is, the better your server is able to handle the heavy load.

Note that JMeter sends virtual users to your website from your computer. Or put another way, the calls are coming from inside the house. This means that your load test does not reflect real world traffic. A proper load testing solution should provide a way to test from external locations, specifically the areas and regions your users are located. This will show you performance from the user’s perspective and provide more realistic load testing results.

If the features and functionalities provided by JMeter are inadequate for your needs, you may want to try a cloud-based load testing solution, such as LoadView, that can send large numbers of concurrent users to your site from geo-locations all over the world.

The LoadView platform supports JMeter load testing. Upload JMX files into the LoadView platform, configure your load test settings, and execute your load tests from multiple geo-locations. LoadView offers enterprise-level features and packages that can meet your organization’s needs.

See how LoadView compares with other load testing tools on the market.