Tutorials

This is How to Load Testing Website with Apache JMeter on Ubuntu 20.04

In this article, I will show you how to install Apache JMeter and how to use it to do load testing on websites. JMeter is an open-source Java-based load testing tool. It is useful to check and improve the performance after developing a new website. With load tests, it checks the performance of the system and helps to stimulate the weight of the load. As it is mainly focused on testing web applications, one can make a better website for all the users. But now, it is also used for different other purposes like functional testing and database testing.

Now let’s see how to install the Apache JMeter and use it on Ubuntu 20.04.

How to install Apache JMeter

As JMeter is a java based application so you must have to install java first. Let’s check if java is already installed with the following command:

$ java --version

If java is not installed then you must have to install it with the below command:

But first, update the system with the command:

$ sudo apt update -y

Now, install the latest Java version:

$ sudo apt install openjdk-16-jdk -y

Now, let’s verify if the java version was installed on our system with the following command:

$ java --version

We are going to test the load of the apache webserver using JMeter in this tutorial. We have already installed apache webserver with the following command:

$ sudo apt install apache2 -y

After installing it, start and enable the Apache webserver.

$ sudo systemctl start apache2
$ sudo systemctl enable apache2

Now, Apache JMeter is not available on Ubuntu 20.04 by default so download it with the following command.

$ wget https://downloads.apache.org//jmeter/binaries/apache-jmeter-5.4.1.zip
Advertisement

Also, you can download the latest version of Apache JMeter through the following URL. Click on apache-jmeter-5.4.1.zip from the binary section as shown in the picture.

https://jmeter.apache.org/download_jmeter.cgi

Now it will be downloaded by default on the Download folder. Go to that section and extract JMeter as shown below:

How to launch the Apache JMeter Application

First, open the terminal and go to the JMeter directory to open it.

$ cd Downloads/apache-jmeter-5.4.1/bin/

Now, run the command to start the JMeter application

$ ./jmeter

The JMeter interface will be shown after the successful installation of Apache JMeter as shown below:

Website Performance Test using Apache JMeter

Now, as you see the default test name on the left side of the interface, you can change it as you wish. We have set it to Test 1 and set comment to mytest1 as shown below:

Add Thread group

On the left navigation, right-click on Test 1 then click Add -> Thread(Users) -> Thread Group.

Then you can set the number of threads, ramp-up periods, and loop count on this section as shown below:

Add HTTP Request Sampler

Now, you must set the sampler type for the test. Here, select HTTP Request for the sampler as it hits the server for the resources. Go to left navigation, right-click on the thread group then select add -> Sampler -> HTTP Request.

Here, type HTTP on the protocol section and put your domain name or Ip address of the web server that you want to test.

Add View Results in Table Listener

Now, select the listener type so that the result of the load test will be shown as output.

For that, first right click on the HTTP Request -> Select Add -> Listener -> then select View Results in Table as shown below:

Run the test and View the result

Finally, you have set the basic configuration for the test. Click on the start button to start the test.

After some time, the result will appear after the testing is completed.

Conclusion

In this tutorial, we have installed and run the test plan to test the Apache webserver on Ubuntu 20.04 desktop. You can also test the performance and limitations of your website with the help of Apache JMeter and get to know the issue and boost up the performance of your website. Thank you!