Software Performance Testing with Apache JMeter
Last Updated on
Jun 24, 2020
In our previous blog, we discussed the importance of software performance testing in the success of a software application. In this blog, we’ll discuss the guidelines for the same using one of the most popular software testing tools – Apache JMeter.
There’s no doubt that every software testing company conducts performance testing before releasing any software application. As it ensures performance, and customer satisfaction & also protects investment against probable product failure. Increased usage of smartphones by users has led to a sudden surge in engaging applications for the same. Every software application is developed with diligence but needs to go through a thorough testing procedure to ensure a great performance.
The tools used for software testing are equally important as the testing process itself, as it ensures improvement in reliability, scalability, and performance of any software, web, or mobile application. Generally, tool selection is based on the technology of the product and client preference. Let’s discuss one of the most popular software testing tools Apache JMeter.
What is Performance Testing?
Performance testing is a testing method to analyze the system performance like responsiveness and stability under a given certain workload. With performance testing, some other metrics like scalability, reliability, and resource usage are also measured.
Performance Testing focuses on monitoring software programs:
- Reliability: It helps to analyze whether the software product is secure or not.
- Speed: Defines whether the software responds instantly or not.
- Stability: It concludes if the application is stable in the case of diversifying workloads.
- Scalability: Analyzes the amount of load the software product can handle simultaneously.
Significance of Performance Testing
Performance Testing is important for every software as it provides all the information to stakeholders about their application regarding speed, responsiveness, stability, and scalability. Moreover, it uncovers the requirements of the product before it is launched to the market.
Despite this, businesses implement performance testing at least once because of the following reasons:
- It helps to define whether the software meets performance specifications and can manipulate up to 1,000 simultaneous users.
- It helps to identify new deployment performance against previous versions.
- To find computing bottlenecks in an application.
- Finds out the inconsistency in the server and does an analysis of response times.
- To compare multiple systems and recognize the one that performs best.
- It ensures that your system achieves the performance criteria.
- It helps to test the system as a whole under load and quickly identify the errors.
Generally, we concentrate on two obligations while testing any site – that we haven’t introduced a change that slows down the rendering speed of the site and that we haven’t broken any sheets. For other software apps, we incorporate a section of load testing there too.
What is Load Testing?
Now we know what is performance testing and why it is important, but do you know that there are various types of performance testing? Yes, Load Testing is one of the types of non-functional performance testing process that resembles a real-world load on software. Without it, your application could collapse inadequately in real-world conditions as it is accessed by multiple users simultaneously. It focuses on improving performance bottlenecks and ensuring the smooth functioning of a software application before deployment.
The main motive behind performing load testing is to verify how much load a system can handle. Despite this, it can also be used for identifying the maximum operating capacity of any software and defining whether the present infrastructure is enough to run the software smoothly.
Here are a few Tools used for Load Testing and Performance Testing:
- Apache JMeter
- LoadNinja
- WebLOAD
- NeoLoad
- LoadView
- LoadUI
- LoadRunner
- Silk performer
- Stress Stimulus
- Rational performance tester
What is Apache JMeter?
It is an open-source tool for software performance testing, i.e. there is no licensing fee and it is available free. It delivers reliable results for performance & load testing requirements and also provides a report on key bottlenecks and areas for improvement of the web application. It is a free tool but it requires an expert software tester to set up the right framework for performance tests with the most optimized architecture, which would result in various statistics of the performance criteria of an application.
Why prefer Apache JMeter?
Two of the most popular Software Testing Tools available in the market are HP Load Runner & Apache JMeter. HP Load Runner is the market-leading software testing tool, but it comes with a high price tag. While Apache JMeter is an open-source software testing tool (i.e. free) and it has many advantages beyond performance testing for any specific software/web application. It is best for simulating a heavy load on a single server or a group of servers to analyze the performance level. It works fine on the networks or different objects to evaluate their strength under the stress of different types of loads.
Here are some major reasons to take into consideration while choosing Apache JMeter for your next project:
- Freely available: No cost is charged for using Apache JMeter. It is a user-friendly platform that allows users to automate their work.
- Graphical Analysis: You can do performance testing representation in a graphical format like the report, graph, table, tree, etc., to make it representable and interesting.
- Performance Testing of Web Applications: With JMeter, you can do testing for both static and dynamic resources. Static resources include HTML and JavaScript, whereas dynamic resources include AJAX, JSP, and Servlets.
- Stress Testing and Load Testing: Stress and Load testing both can be done using JMeter. It also helps you to recognize your current users that the server can handle.
- Platform Independent: As we discussed earlier, JMeter is a 100% Java-based application that is used on various platforms to run a Java Virtual Machine.
- Framework: It is a framework that allows multi-threading and indicates several separate thread groups to achieve synchronous and concurrent sampling.
What are the Advantages of Apache JMeter?
Apache JMeter is a non-proprietary open-source software that helps to fill a void by performing the testing process easier.
If you’re planning to use Apache JMeter for your project then here are some advantages that you’ll get by working with it:
Open-source – JMeter is free open-source software that is available for free. It is a 100% pure Java-based application used by the developers to modify and customize the code as per their project requirements.
Reporting –JMeter also allows you to create a dashboard report. You can also create a host of reports using JMeter so that you can easily identify the Performance test execution results.
Comprehensive Documentation – This is one of the most essential things to be noted while working with JMeter. It offers robust documentation so that users can clearly identify each step from the beginning including connection and configuration of the test settings and lastly, creating the final report.
User-friendly –JMeter has an amazing graphical user interface that allows you to create a test plan and set the elements. To add elements to your existing test plan, just right-click on the tree scenario and add what you need to do.
Recording –Users can also record HTTP/HTTPS to generate a Test plan by using the Recording facility feature provided by JMeter. If not, you can also use a Proxy Server which allows JMeter to record your actions while you are browsing any web application with your normal browser.
Support –It is specially designed for JMeter performance testing. Do you know, that you can also perform non-functional tests such as Web service testing, Stress Testing, Distributed Testing, etc. by creating test plans?
Demonstration: JMeter Performance Testing
Here are the 5 major steps to follow while performing JMeter Performance Testing:
1. Configure Apache JMeter
- Go to the Apache JMeter folder→ Bin Folder
- Select the JMeter.bat file and double-click on it
This may take a while, and then the JMeter window will open on the screen.
Now, the test plan is renamed performance testing.
2. Add a Thread Group
- Right-click on the Performance Testing,
- Visit Threads (Users) → Thread Group
A thread group offers various options such as:
- Action to be taken after there is an absurdity: you can choose it the way you require for your project
- You’ll see a “number of threads”, from that pick the number of users you require
- Now, select the “ramp-up period in seconds” that affirms the time gap connecting the users’ hits
- A “loop count” option is also available where you can choose how many times you want to run the test for the number of users. Else, you can also choose the test to run infinite times (If you’re not aware how many times the test plan has to be run)
- It offers a scheduler that will help you schedule the start time and end time of the test
3. Add the HTTP Request
- Right-click on the Thread group → add option → sampler option
- A menu will be available, from that choose the HTTP request choice
Now, you can see a Server Name which will give the server name in that.
- Go to Your Project site
- Copy the URL
- Come back to the JMeter window
- Paste the URL in the Server Name box
Don’t give HTTP requests or HTTPS as these are protocols that will be seen in the other box, it will automatically be taken in the HTTP request case.
- Go to the path dialog box and leave a forward slash.
The forward slash is used to access the router page.
- Rename this HTTP request as Simple.
See the results and add listeners. Listeners are used to providing the outputs of a load test. There are different types of listeners available in JMeter, and for effective results, add plugins.
4. Add Listeners
As we said, there are various types of listeners that you can use to a great idea about the representation that the JMeter offers:
- Right-click on the Thread Group
- Go to Add → Listener option → Tree → View Results
- Again, right-click on the listener → graph results
- And for the third listener, right-click again, view Results in the Table option
Now, you’re all set to run the test.
5. Run the Test
Before you run the test, save the JMeter test as .jmx and click the green button to run the test.
In the “View Results Tree,” see the test running with the same graph results. Now, you can see the time the test has been executed.
The test will run for a while. Go to the “view results in the table” and see the different performance testing metrics on the screen. You can see the thread name, label, ramp-up period, Sample Time per second, Bytes, Sort Bytes, config element, and the latency.
In the tree option, see various performance testing metrics by clicking on any of the tests. In the graph results, you can see the graph coming on the screen which represents the tests taking place concerning the IP address, config element, thread, ramp-up period, and loop counts.
Lastly, JMeter creates a request and sends it to the server. When the server receives the request sent by JMeter, it collects them and imagines those details in a chart. That after, it prepares the server’s response and generates the test results in several formats so that the tester can analyze the data.
Entry Criteria for Load & Performance Testing
- To start Performance testing we need a stable & bug-free application in a staging environment.
- Test Document – Load Test scenarios document with valid steps. All the Test Metrics and Exit Criteria are defined in the document.
- Performance testing environment with tool setup.
- High-speed connection to do performance testing.
- Prepare a data-driven framework for performance testing.
- Client Server credentials to prepare Performance & Resource monitor.
Exit Criteria for Load & Performance Testing
- After all the test scripts are prepared and executed.
- All scripts run properly with any number of data.
Load Test Approach: Below figure shows the flow of execution in the load testing approach.
Other Monitoring Tools that can be used for Analysis and Continuous performance measurement
- New Relic: Continuous monitoring tool that is integrated with server and gives the data on the web application of CPU utilization, RAM consumption, throughput, and Bandwidth usage.
- SQL profilers (For .Net Applications): Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services. Users can capture and save data about each event to a file or table to analyze later.
- .Net profilers: Zero-overhead profiler makes code profiling and memory usage optimizations simple and fast.
- Jet profiler (For PHP Applications): Jet Profiler is a real-time query performance and diagnostics tool for the MySQL database server. Its core features are Query, table and user performance, Graphical visualization, Low overhead, and User friendly.
Amidst a range of wonderful software testing tools available in the market, Apache JMeter is a powerful Java-based performance testing tool that is open-source and available absolutely free of cost. It is used for Performance, Load, and Stress testing of web applications. Today, companies are opting for Apache JMeter for software testing as the results are not only fantastic but also reliable.
Comments