Apache JMeter is a load testing tool. It is open-source and Java-based. JMeter can be used for the analysis of a system's functional behavior. It measures a system's performance under a load test. The load, in this case, simulates those end-user behaviors that approach the limitations of an application's specifications. JMeter can be used for simulating loads that are variable or heavy. The simulation may be conducted on single or multiple servers. It may alternately be conducted over networks or objects testing a system's strength. JMeter simulates a group of users. They send requests to a server or network. The returning statistics are shared back with a user through visual diagrams. JMeter also offers support for browser plug-ins.
In this tutorial, we will show you how to install and use Apache Jmeter on Ubuntu 20.04.
Also Read
Prerequisites
- A fresh Ubuntu 20.04 Desktop VPS on the Atlantic.net Cloud Platform.
- A root password is configured on your server.
Step 1 - Create Atlantic.Net Cloud Server
First, Login to your Atlantic.Net Cloud Server. Create a new server, choosing Ubuntu 20.04 as the operating system, with at least 2 GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.
Once you are logged into your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.
apt-get update -y
Step 2 - Install Java
Apache JMeter is a Java-base application so Java must be installed in your system. You can install it by running the following command:
apt-get install openjdk-8-jdk -y
After installing Java, verify the installed version of Java with the following command:
java -version
You should get the following output:
openjdk version "1.8.0_272"
OpenJDK Runtime Environment (build 1.8.0_272-8u272-b10-0ubuntu1~20.04-b10)
OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
Step 3 - Install Apache Web Server
In this tutorial, we will use Jmeter to test the load of the Apache webserver. So you will need to install the Apache webserver in your system. You can install it with the following command:
apt-get install apache2 -y
After installing Apache web server, start the Apache service and enable it to start at system reboot:
systemctl start apache2
systemctl enable apache2
Step 4 - Install Apache JMeter
By default, Apache JMeter is not available in the Ubuntu 20.04 default repository. So you will need to download it from its official website:
You can download it with the following command:
wget https://downloads.apache.org//jmeter/binaries/apache-jmeter-5.3.zip
Once downloaded, unzip the downloaded file with the following command:
unzip apache-jmeter-5.3.zip
Step 5 - Launch the Apache JMeter Application
Next, change the directory to the JMeter:
cd apache-jmeter-5.3/bin
Now, start the JMeter application with the following command:
./jmeter
You should see the JMeter interface in the following page:
Provide the name of your Test Plan and click on the Save button. You should see your Test plan in the left pane as shown below:
Next, you will need to add some components in your Test plan.
Add Thread Group
To add a thread group, right-click on the plan1 and click on the Add => Threads (Users) => Thread Group. You should see the following page:
Here, you will need to provide the Number of Thread Users, Loop Count and Ramp-Up Period. Once you are done, you can proceed to the next step.
Add HTTP Request Sampler
Next, you will need to add the HTTP Request Sample elements to represents a page request that each thread (user) will access.
To add it, right-click on Thread Group and click on the Add => Sampler => HTTP Request. You should see the following page:
Here, you will need to provide a name or the IP address of your web server that you want to test.
Add View Results in Table Listener
Next, you will need to add the Listener to output the results of a load test.
To add a Listener, right-click on HTTP Request and click on the Add => Listener => View Results in Table. You should see the following page:
Step 6 - Run Test and get the test result
At this point, your basic test plan is setup. Now it's time to run the test.
Now, click on the green arrow button to start your test plan. You should see the test results in the following page:
Conclusion
In the above guide, you learned how to install the Apache JEmeter on Ubuntu 20.04 desktop. You also learned how to create a basic test plan and run the test. I hope you can now easily use Apache JMeter for load testing.
If you would like to host your application on the cloud server then I would recommend to try Atlantic.net Cloud and get started with one full year of free VPS hosting in the cloud!
Top comments (2)
An error occurred: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
I got the same error, solved it by installing java-8 and switch to java-8 whenever I need to use jMeter.
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java