Can we use JMeter for load Testing?
JMeter is 100 percent open-source software developed by Stefano Mazzocchi of the Apache Software Foundation for load and performance testing systems. It is a performance analysis and measurement tool for web applications and services. JMeter is a tool for testing web applications. It is also used to connect to JDBC databases and access internet services, among other things. JMeter can also be used to test for regression. It is also referred to as an all-in-one tool. JMeter load testing is crucial tool for identifying whether the web application under test can manage high traffic. It is also useful for analyzing a server’s overall performance when it is under a lot of strain.
Load Testing Process
The Load testing process will be completed in the following steps:
Step 1: Test Environment Setup
To begin, build up a dedicated test environment for doing load testing. It guarantees that testing is carried out correctly.
Step 2: Load Test Scenario
Load test scenarios are built in the second stage. The application’s load testing transactions are then identified, and data is prepared for each transaction.
Step 3: Test Scenario Execution
The load test scenarios defined in the previous phase are currently being executed. The data is acquired using a variety of measurements and metrics.
Step 4: Test Result Analysis
The results of the tests are examined, and several recommendations are given.
Step 5: Re-test
If the test fails, it is repeated to obtain the correct result.
Metrics of Load Testing:
Metrics are used to determine how well load testing performs under various conditions. It is normally done after the load test scripts/cases have been prepared. Load testing can be evaluated using a variety of measures. The following is a list of some of them.
1) Average Response Time:
This is the average time it takes to react to a client, customer, or user request.
2) Error Rate:
The Error Rate is a percentage that expresses the number of errors that occurred during requests as a percentage of the total number of requests.
It is used to calculate the amount of bandwidth needed for load scripts or tests, as well as the amount of data needed to analyze requests passing between the user server and the application main server. In kilobytes per second, the speed is measured.
4) Requests Per Second:
It shows how many queries are delivered to the application server every second.
5) Concurrent Users:
It is used to count the number of active users present at any given time.
6) Peak Response Time:
The time it takes to react to a request is known as the peak response time.
Load Testing using JMeter with Examples
Example of https://jmeter.apache.org to measure the performance of the website.
Steps to be followed:
Select Test plan and add thread group->Add->Threads(users)->Thread group
We must add the following details:
- Thread Name: Users.
- Number of threads (users): The term “threads” refers to the user. The total number of virtual users who are running the test script.
- Ramp-up Period (in seconds): The ramp-up period is the amount of time it takes for all threads to execute (users). If the thread count is 100 and the ramp-up time is 10 seconds, then 100 threads will be executed in 10 seconds.
- Loop Count: The number of times the script has been executed.
Add Sample HTTP Request by navigating Add ->Sample ->HTTP Request
We must add the following details:
- HTTP request name example: Homepage.
- Protocol: https
- Server name: jmeter.apache.org site where we want to perform load testing.
- HTTP Request Method: Example GET method.
- Path: The Path will be the location of the resource on the server that you are targeting. Example: /index.html
- Port Number: if the port is the standard HTTP port of 80 you can leave the Port Number field blank as it is implied.
View Result Trees
This Listener has the advantage of being able to check both the request and the answer by comparing the requirement and the actual outcome.
View Results in Table
In a table format, it shows all the samplers’ data.
Listener shows the data below:
- Sample: Number of Samplers in total.
- Start Time: It is the time when samples are given out.
- Thread Name: The thread’s name.
- Label: Label
- Sample Time (ms): Once the request is initiated by the server, the time taken to get the response of the request is the Sample time.
- Status: Status as Pass/Fail symbol.
- Bytes: The client has received bytes.
- Sent Bytes: Data is delivered to the server in bytes.
- Latency: It is the amount of time it takes for a program to reply to a user’s request.
- Connect Time (ms): This is the amount of time it takes for a request to be delivered to the server.
The summary report contains all the necessary informational data for analysis.
The below data is provided by the listener:
- Label: name or URL
- Samples: number of users per request
- Average: time taken by samples to run.
- Min: Minimum time taken by a sample.
- Max: Maximum time taken by a sample.
- Std Dev: It differs from the average reaction time of the sample.
- Error%: Failed requests percent.
- Throughput: total number of requests handled by the server.
- KB/Sec: It is the downloaded data in KB/sec when performance execution is in progress.
The Graph Results listener should be used if the user expects results in graph form. The graph’s x and y axes represent the most recent sampler’s data and the response time, respectively.
Aggregate Graph is one of the important listeners in JMeter. All the necessary information is provided by this listener.
- Samples: The Total number of Samples.
- Average: Average of time.
- Min: minimum time request taken to go to the server.
- Max: maximum time request taken to go to the server.
- Error%: Number of failed sampler/Total number of Sampler.
- Throughput: Total number of requests handled by the server.
- Received KB/second: This defines how many kilobytes per second received by the Client.
- Sent KB/second: how many kilobytes are delivered to the server every second.
- 90% Line: It signifies that 10% of the samplers took longer than expected to reach the server.
- 95% Line: It signifies that 5% of the samplers took longer than expected to reach the server.
- 99% Line: It signifies that 1% of the samplers took longer than expected to reach the server.
Apache JMeter is one of the greatest tools available for load testing. It is free, open-source, and cross-platform due to its Java nature. We looked at what load testing is and how JMeter works and how to assemble your tests. Performance testing, functional testing, and load testing of web applications are all done with this software. JMeter achieves this by simulating a large number of concurrent users to create a significant load.