JMeter Performance Testing on Web Application
Lets check the performance of NumpyNinja blog website , Its Hackathon Time and many hit NumpyNinja website to write blogs. How much load the website is able to handle per day? Yes we are going to do Performance testing to ensure that an application can handle user traffic without any performance issues.
Performance Testing is a non-functional software testing
In this post, we will see how to do load test and see the response times and the number of users it can handle, etc.
What is JMeter ?
Apache JMeter is a software tool that is used for load testing applications on various protocols and technologies.
JMeter is designed to do load test on the functional behavior and measure performance of the application.
Analyze and measure the performance of web application or a variety of services.
Performance testing means testing a web application against having heavy load, multiple and concurrent user traffic.
Used for testing web application, functional test , database server test, API testing etc..,
It is written in Java and can be run on any Java-supported platforms such as macOS, Windows, etc.
It even offers IDE for the load test development.
You can run load tests in two ways: one way with the IDE and another way with the CLI.
JMeter can test both dynamic and static resources by providing some inputs while testing.
JMeter is multithreaded and can simulate a lot of virtual users.
How JMeter works ?
Tools Used for Performance Testing?
1. Apache JMeter
2. Micro focus Load Runner
3. Neo LOAD
4. Load Ninja
Factors to be checked while doing Performance Testing
Speed — Performance testing ensures an app runs fast enough to keep a user's attention and interest.
Scalability — it tests how the system is going to perform during a sudden spike or fall of user request loads.
Stability — Stability testing is a non-functional process of testing the behavior of the application by applying maximum load.
Different types of Performance testing
1. Load Testing
2. Stress Testing
3. Spike Testing
4. Volume Testing
5. Scalability Testing
6. Endurance Testing
Test Plan This is the root element of the JMeter and whatever you do you need to save that as a Test Plan. It actually contains a lot of components such as ThreadGroups, Preprocessors, Postprocessors, assertions, and listeners, etc. A Test Plan can contain several Thread Groups and all these thread groups in the test plan can run concurrently by default.
Thread Groups - Number of users The next thing after the Test plan that we configure is Thread Groups and these are the entry points for all of your tests. The Controllers and samplers for a test must be under a thread group. You can place listeners either under a thread group or under a test plan. If you place the listener under a test plan it applies to all the thread groups. You can configure a number of threads and JMeter spins off multiple threads to simulate concurrent connections to the server. There is ramp-up time for all the threads to be active.
Thread users - how many users want to perform test
Each thread represents one user using the application under test
Every thread stimulates a request There are two types of controllers:
Sampler controllers send requests to a server. These include HTTP, FTP, JDBC, LDAP, and so on,
Logical Controllers where you can customize the logic.
Samplers These are the components that can be used to send the request to the server and wait for the response such as HTTP Request, Java Request, Junit Request and etc.. Request is called a Sampler in JMeter.
Listeners Listeners are the components that can gather results and show the summary reports. They allow you to save the data either in XML or CSV format.
Creating a Test Plan Let’s create a test plan for the below requests for the example project provided above. First, make sure your project is running on your local machine.
Define the Number of Threads (Users)
User is called a Thread in JMeter. Here we define the count of virtual users to simulate the real users.
Listener- Verify the Server response
Here we add Listeners to check whether the server responds back to the request sent.
Steps to follow to Create First JMeter Test:
To create a Thread Group
Right click on Test Plan -> Add -> Threads(Users) -> Thread Group
Thread Group Details to enter :
10 users -> 10 request-> RampUpPeriod(inSeconds) 3
That is 1st user 3sec , 2nd user 3 sec .....
Every 3 secs interval user will send request
Loop Count : same no of users , how many times user should send request
If u want to run the same request with multiple users / multiple cycles
Users : no of user: 10
To create a Sampler
Right-click on Thread Group -> Add -> Sampler -> HTTPRequest
Server name/IP: www.numpyninja.com
Listeners to see the report of how much time it is taken to hit the website
View Results Tree, Summary Report, View Results in Table
Add Listeners to verify whether the server is responding
By default, JMeter considers HTTP requests. Here we are going to get load details on this URL.
Right-click on Thread Group -> Add -> Listener -> View Results Tree
Right-click on Thread Group -> Add -> Listener -> Summary Report
Right-click on Thread Group -> Add -> Listener -> View Results in Table
Save the Test Plan
Run The Test Plan
View Results in table
Latency : how much time taken to hit the server
View Results in Tree
Green shows Request to server is success
I hope, This article will help you to understand How to do Performance Testing on a web application and check the load time, connect time ,latency ........
You can add Timers if you perform load testing , stress testing
By doing performance testing , we can check whether the software meets speed , stability and scalability requirements under expected workload.
You must have got an idea on the topics explained in this blog. Lets explore more and learn New Topics.