August 16, 2023

How to use JMeter for Performance Testing

The best time to establish protocols with your clients is when you onboard them.

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Load Testing

JMeter load testing is a testing procedure carried out with the aid of Apache JMeter, a Java-based open source desktop program used for load testing. The web application being tested for its ability to handle high load requirements can be evaluated using JMeter for load testing. Analyzing the server as a whole while it is under tremendous stress is also helpful.

Performance Testing

JMeter Performance Testing is a method of testing the performance of a web application that employs Apache JMeter. JMeter for performance testing allows you to test both dynamic and static resources, discover concurrent users on websites, and perform a variety of graphical analyses. JMeter performance testing includes web application load and stress tests.

  • JMeter can be used to test the performance of both static resources such as JavaScript and HTML, as well as dynamic resources, such as JSP, Servlets, and AJAX.
  • JMeter can discover maximum number of concurrent users that your website can handle.
  • JMeter provides a variety of graphical analyses of performance reports.

JMeter Performance Testing includes:

  • Load testing: Simulating multiple users accessing Web services concurrently to simulate expected usage.
  • Stress testing: Every web server has a maximum load capability, hence stress testing is necessary. The web server begins responding slowly and starts making faults when the load exceeds the limit. Finding the maximum load the web server can manage is the aim of the stress testing.

The figure below shows how JMeter load Testing simulates the heavy load:

Create a Performance Test Plan in JMeter

The following should be determined prior to assessing the performance of the target web application:

  • Normal Load: Visitors to your website on average.
  • Heavy Load: The maximum number of users visit your website.
  • What are you trying to achieve in this test?

The flowchart for this concrete example is shown below.

Step 1) Add Thread Group

  1. Start JMeter.
  2. Select Test Plan on the tree.
  3. Add Thread Group

Right click on the “Test Plan” and add a new thread group: Add -> Threads (Users) -> Thread Group

Adding Thread Group

In the Thread Group control panel, enter Thread Properties as follows:

Thread Properties

  • Number of Threads: 100 (Number of users connects to the target website: 100).
  • Loop Count: 10 (Number of time to execute testing).
  • Ramp-Up Period: 100.

The Thread count and the Loop counts are different.

Ramp-Up Period instructs JMeter how much time to wait before initiating the following user. If there are 100 users and a 100-second ramp-up period, there would be a 1-second delay between starting users (100 seconds / 100 users).

Step 2) Adding JMeter elements

Now we determine what JMeter elements are in this test. The elements are

  • HTTP request Default

This element can be added by right-clicking on the Thread Group and selecting: Add -> Config Element -> HTTP Request Defaults.

In the HTTP Request Defaults control panel, enter the Website name under test (http://www.google.com).

  • HTTP Request

Right-click on Thread Group and select: Add -> Sampler -> HTTP Request.

In the HTTP Request Control Panel, the Path field indicates which URL request you want to send to Google server.

For example, if you enter “calendar” in Path field. JMeter will create the URL request http://www.google.com/calendar to Google server.

If you keep the Path field blank JMeter will create the URL request http://www.google.com to Google server.

Step 3) Adding Table result

JMeter can show the test result in Table format. Right click Test Plan, Add -> Listener -> View Results in Table.

Table Result

Step 4) Run Test and get the test result

Press the Run button (Ctrl + R) on the Toolbar to start the software testing process. You will see the test result displayed on Table in real time. The picture below presents a Table of a test plan, where we simulated 100 users who accessed the website www.google.com.

At the bottom of the picture, there are the following statistics, represented in colors:

  • Black: The total number of current samples sent.
  • Blue: The current average of all samples sent.
  • Red: The current standard deviation.
  • Green: Throughput rate that represents the number of requests per minute the server handled.

The Throughput is the most important parameter. It represents the ability of the server to handle a heavy load. The higher the Throughput is, the better is the server performance.

NOTE: The above values(in the table reports) depend on several factors like current server load at Google, your internet speed, your CPU power etc.

CodeStax.Ai
Profile
August 16, 2023
-
6
min read
Subscribe to our newsletter
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Share this article:

More articles