Performance Testing Using Apache JMeter

  1. Load testing
  2. Stress testing

Getting Started

To follow this tutorial, you will need a personal computer to run JMeter and a server where your software is installed. In this example, we will be testing a LEMP stack WordPress site running on a 1CPU 1GB RAM Alibaba Cloud Elastic Compute Service (ECS) virtual server. We will run our JMeter application on our PC.

JMeter Installation

Our tutorial involves the use of the JMeter desktop application and as such, there are many operating systems that could be used to run the tool. It is, therefore, not very useful to cover intricate details about installing it to the respective operating systems. But it a very easy tool to install, and using a package manager is the easiest method of them all. The other option would be to download the files from the official website and install Java version 6. If you need to download these components, follow these links:

  1. Oracle Java or OpenJDK (version 6 and above)
  2. Apache JMeter
yum localinstall jdk-8u152-linux-x64.rpm
sudo apt-get install oracle-java8-installer

Creating Your Test Plan

A test plan guides JMeter in the execution of a test run. Typically, a sample test is comprised of:

  1. Thread Groups
  2. Logic controllers
  3. Sample generating controllers
  4. Listeners
  5. Timers
  6. Assertions
  7. Configuration elements

Test Plan Elements

A test plan will be the topmost object of the tree and the elements below constitute its objects.

Configuration Elements

Configuration elements include:

  1. HTTP requests default used for HTTP requests such as server name, IP, port number etc.
  2. HTTP cookie manager
  3. Variables defined by the user to store data such as usernames and passwords

Thread Groups

Thread groups constitute the beginning points of test plans and includes controllers and samplers. Thread groups determine JMeter threads used in executing a test by allowing you to:

  1. Define the threads for tests
  2. Define the ramp-up time
  3. Define the number of test runs


JMeter includes two controller types:

  1. Samplers
  2. Logical controllers


They allow you to access test information gathered by JMeter test runs while in progress. They include:

  1. Graph results listener — access to response times
  2. View results in tree listener — displays in basic HTML and XML the sampler requests and responses
  3. Summary reports — maintains test reports for all requests in tables
  4. Real-time graph — is a line graph indicating the response time evolution for individual requests in a test


Timers allow for a delay between sampler executions in JMeter. By default, the program executes them sequentially without any delay between requests.


Post-processors kick-in after sampler requests have been made. They are attached to sampler elements and execute after the running of the element.

Building Your First Test Plan

Upon initialization of JMeter, the Test Plan field on the interface should be empty as shown below:

Step 1: Add a Thread Group

Follow the steps below:

  1. Right-click on Test Plan
  2. Select Add
  3. Select Threads (Users)
  4. Select Thread Group
  1. Number of Threads (users): defines how many users JMeter will attempt to simulate. In this case, it was set to 50.
  2. Ramp-Up Period (in seconds): indicates the time through which JMeter distributes the start of the threads. In this case, it was set to 10.
  3. Loop Count: This defines the number of times tests are executed. This case study uses 1.

Step 2: Add an HTTP Request Defaults

The next step is to set the HTTP Request Defaults using the Config Element. It comes in handy when sending multiple requests to a server. Adding HTTP Request Defaults to a Thread Group is as follows:

  1. Select a Thread Group
  2. Right-click and select Add
  3. Select Config Element
  4. Select HTTP Request Defaults

Step 3: Enable HTTP Cookie Manager

This option allows you to add cookie support if your server uses the web tracking technologies. Follow the procedure below:

  1. Select Thread Group
  2. Right click on the mouse and select Add
  3. Select Config Element
  4. Click HTTP Cookie Manager

Step 4: Include an HTTP Request Sampler

Use this option to include an HTTP request sampler in your selected thread group.

  1. Select Thread Group
  2. Mover over the option Add
  3. Move over the option Sampler
  4. Select HTTP Request

Step 5: Adding View Results in Table Listener

The results of JMeter load tests are output in the listeners. The tool has numerous listeners as has been highlighted. We shall use the Table in this case:

  1. Right-click the Thread Group
  2. Select Add
  3. Select Listener
  4. Select View Results in Table

Step 6: Run Your First Test Plan

Our first simple test plan is all set up and ready to run. After you save the test in a specified file name, select View Results in Table, click Run and initialize the test using the Start. The table below shows the results of our sample test run.

What Your Results Mean

Well, it is time to interpret the results that are displayed in the results table. The green triangle indicates if a request was successful and most probably all of them will indicate green. There is even more information contain details about Sample Time (Ms) and Latency.

  1. Latency: indicates the time lapse between JMeter requests and initial server response
  2. Sample Time: time lapse in milliseconds for the full server request

Load Increase

In the next step, the load is increased to 80 in 10 seconds. Below are the results:


JMeter has many uses in the context of performance improvements and server optimizations. In this article, we have demonstrated how to use JMeter to create and run simple test plans on an Alibaba Cloud Elastic Compute Service (ECS) instance. You can use a variety of customizations available to test how your server responds to real-life simulated requests. Hope you enjoy trying out the samplers, listeners and configuration tools available on JMeter.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: