How to install Apache JMeter in Ubuntu

How to install Apache JMeter in Ubuntu
After developing a new website, it is very important to perform some tests to find out the limitation of the site, and take necessary actions to remove the limitations for making the site more appropriate for the visitors before publishing. One of the important tests for any website is a load test. How many requests the website can handle at a time or how the website performs when a large number of requests appear on the site can find out by load test.

Apache JMeter is the best tool developed by Stefano Mazzocchi of Apache Software Foundation to perform this type of test and check out the performance of any website. It is used to create a large amount of virtual concurrent traffics to the website for doing the load test. It is open-source software. So anyone can download, install and customize this software to do the test. It is mainly designed for testing web application, but now it is also used for database testing, stress testing, distributed testing, and functional testing. How you can install and run this software is shown in this tutorial.

Install JMeter

JMeter is a developed by Java. So you require to install the latest version of JRE or JDK to run JMeter. If you have installed Java before then run the following command to check the version of the installed Java.

$ java –version

The following output will appear if Java 9 is installed on the system.

If you didn’t install Java before then you can follow the steps from the following tutorial link to install Java before starting the next step.

https://linuxhint.com/install-java-9-on-ubuntu/

Go to the following URL location to download the latest version of JMeter. You can download the binary or source file of this tool from this location. Click on ‘Apache-JMeter-5.0.zip’ link to download the binary zip file of JMeter.

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

Click on Save File radio button and OK button to start the download.

By default, the file will be downloaded in the Downloads folder. Open the folder, right click on the zip file and click on Extract Here from the pop-up menu.

Run JMeter

Press Alt+Ctrl+T to open the terminal and type the following command to go the location from where you can run JMeter.

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

Run the following command to run JMeter and open the JMeter dialog box.

$ ./jmeter

The following dialog box will appear after the successful installation of JMeter.

The following dialog box will appear after the successful installation of JMeter.

Simple Test using JMeter

It is discussed earlier that JMeter can be used for various types of testing. How a simple load test can be done using JMeter is shown in this part of the tutorial. Test name is set to Test Plan by default. If you want you can change the default value. Here, Name is set to Test Plan1 and test1 is set as a comment which is optional. Next, you have to set the variables that you want to use in your test. Here, the site is set as the variable name and tutorials4uhelp.com is set as value. This test will do the load test based on the next configuration of the site tutorial4uhelp.com.

Right-click on Test Plan1 from the left navigation. Click on Add, next Thread (Users) and next Thread Group. It is used to set action, properties, and schedule of Thread Group before starting the test.

In Thread Group, Five types of actions can be taken when any sampler error occurs. These are,

  • Continue
  • Start Next Thread Loop
  • Stop Thread
  • Stop Test
  • Stop Test Now

You can select any of the above actions for your test. Here, the default option is used. Next part of Thread Group is to set Thread Properties. The properties are,

  • Number of Threads (users)
    This property is used to assign the number of virtual visitors that you want for the testing. 15 is set here.
  • Ramp-Up Period (in seconds)
    This property is used to assign the time between two threads. 5 seconds is set here.
  • Loop Count
    This property is used to assign the number of times the thread will run. You can run the thread for unlimited times by selecting Forever checkbox. 1 is set here to run the thread for just one time.

There are other two properties which are “Delay Thread creation until needed” and “Scheduler”. These properties are remained unchecked here. Scheduler Configuration part is used to set the execution time of the test and it will be used in the test if you checked the Scheduler.

Next, you have to set the Sampler type to do the test. Here, HTTP Request is set as Sampler, to hit the server for the resources.

In HTTP Request part, you have to set Web Server, HTTP Request type for the test. You can use HTTP or https as protocol based on your server. By default, HTTP is used. You have to set domain name or IP address of your server in Server Name or IP field. Here, ‘tutorials4uhelp.com’ domain is used as Server Name. Other values remain as the default value.

Next, you have to set Listener type. It is used to view the test results in various format. Here, ‘View Result in Table’ is selected.

Now, you can click on the start button to start the test based on the assigned configurations. You have to wait for some time to complete the thread in this step.

The following screen will appear after completing the test.

Conclusion

JMeter is a popular testing tool now but this software has some limitations. It consumes more memory while doing the test. It is not good for desktop application and it can’t render HTML and JavaScript like the browser. If you are preparing to publish your website then it is very important to check the performance of your site. You can use JMeter for checking the performance of the site by doing different types of test on it. It will help you to detect the problems of your site and take proper actions to solve it.

Related Posts
Leave a Reply

Your email address will not be published.Required fields are marked *