Popular Open source tools for stress testing of a web application
What is Stress Test?
Stress test is kind of real-time diagnostics performance test of a web application in order to determine the stability of your web application under heavy load(stress).
Why we need a stress test?
First of all why we need to do stress test? Let’s take a example: You have created an e-commerce site where the user can buy and sell the products. The server (web application) has been tested and it worked fine with its all functionalities. Now the code has been ready to be deployed to a live server. However, when multiple users started to hit on the live server (web application), the server slows down and stops working. Why did this happen? When website published on live server, it started to get multiple users hit simultaneously and produced a very high load, because server was not able to process the requests and stopped running.
Reason: Testers had performed multiple automated functionality tests excluding “Stress Test” on the web application. In that situation, we need a tool to perform Stress Test on the web applications.
You can pick any of following open source tools for your web application performance hike.
- Bees with Machine Guns
- Apache JMeter
I am going to introduce Apache JMeter
Introduction: Apache Jmeter is a JAVA based Open Source software, which was first developed by Stefano Mazzocchi of the Apache Software Foundation, designed to test the web applications against the heavy load.
Protocols supported by Apache JMeter:
- HTTP, HTTPS
- Lightweight Directory Access Protocol — LDAP
- Simple Mail Transfer Protocol — SMTP
- SOAP/REST Web Services
Create JMeter Stress Test: In Apache JMeter every test has its unique configurations criteria. In my case I’ll do the stress test with 100 users on web application. For this we need to configure Thread Group which is most important part of any testing.
The configuration of thread group depends upon Threads (users), the ramp-up time and the loop count. Here the threads are number of users that will be used to create or run this test or any other specific test. The ramp-up period is total number of time that will be taken for all users to complete the test. Like If ramp-up period is 10 sec with 5 threads then it’ll take 10 seconds to complete the whole test and the loop count is the numbers of times to execute the test.
Now we are using some Elements to complete this test, Like HTTP request, View results in table and view results in tree. You can rename the element names according to your convenience.
HTTP request is the sampler in JMeter that sends the request to particular server name or to IP address.
View results in table and view results in tree are the listeners, ‘View results in table’ show the test plan result in table form and ‘view results in tree’ shows the results of test plan in tree structure.
Please see the following screenshot, it is showing the element section:
Let us do the test for website with specific location like, I pick the following location:
“studysection.com/Certifications/system-administration” (you can use your own website or server). For the testing I am using the 100 threads with 10 second ramp-up period. You can take n numbers of test according to your goal. For result please check following screenshot:
As per above result my average sample time was 4026 millisecond that near to 4 seconds that mean the website is approximately accessible within 4 seconds by each thread., where max of HTTP requests have been executed successfully but some requests failed. That means my server is failed to handle this stress.
Now we’ll check the result in ‘tree structure’ listener to get complete details (http request & response ) of all http requests for better understanding. Check following screenshot:
In above screenshot, It cleared that why the thread request had failed, because the website was currently unable to handle the HTTP request due to a temporary overloading.
The JMeter tool is the good way to perform the load test for your web application before production deployment.