hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Performance Testing using Apache JMeter

What is Performance Testing ?

In Software Quality Assurance, Performance Testing-a testing practice performed to determine how a system performs in terms of responsiveness and stability under a particular workload .It helps to investigate, measure, validate or verify other quality attributes of the system such as scalability, reliability and resource usage.

Why Performance Testing is necessary?

  • Help to evaluate the stability of the software.

  • Help to find out performance defects in the early stages of development.

  • Help the team understand how the application runs under normal load.

  • Help verify the functional characteristics of the application.

  • Help to identify performance bottlenecks before deploying to the production environment.

Flow Chart of Performance Testing



1 → PERFORMANCE DEMANDS

Recently I worked in a Web scrapping project using Selenium and Java where I have faced lots of exceptions and challenges due to the website. Then I thought to do a performance testing for the same website. Here I am going to do load testing for a web application with 3000 users and lets see its performance in terms of Throughput and Standard deviation.

2 → PERFORMANCE TESTING PREPARATION

Apache JMeter

Apache JMeter is an Apache project that can be used as a load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications. This can be used to test performance both on static and dynamic resources, Web dynamic applications and also to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types.

First step is to download the Java supported open source tool Apache JMeter. Apache JMeter 5.4.3 (Requires Java 8+)

After downloading the zip folder and run the batch file from bin folder.



3 → PERFORMANCE TESTING EXECUTION

Before testing the performance of target web application, we should determine-

  • Normal Load: Average number of users visit your website

  • Heavy Load: The maximum number of users visit your website

  • What is my target in this test? — Its 3000.

Step 1: Add Thread Group

Start JMeter →Select Test Plan(Right click)→ Add Thread(Users)Group



  • Number of Threads: 3000 (Number of users connects to the target website: 100)

  • Loop Count: 1 (Number of time to execute testing)

  • Ramp-Up Period: 1(Ramp-Up Period tells JMeter how long to delay before starting the next user)



Step 2 : Adding JMeter (Sampler)elements

Right click on Thread Groups → add Sampler → add HTTP Request



Add the Web address of the site to be tested in Server Name or IP and path as shown below:



Step 3 : Adding Graph Result

Right click Test Plan, Add → Listener → Graph Results, Table Results, etc., as many forms as we want.




Step 4 : Lets run the test and see the results.

Press the Run button (Ctrl + R) on the Toolbar to start the software testing process. You will see the result in Table format.




You will also see the test result display on Graph in the real time.



4 → RESULT ANALYSIS AND PERFORMANCE TUNING

Result Analysis

To analyze the performance of the web server under test, you should focus on 2 parameters

  • Throughput

  • Standard Deviation

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

In this test, the throughput of server is 13,642.565/minute. It means server can handle 13,642.565 requests per minute. This value is quite high so we can conclude that server has good performance.

The standard deviation is shown in red — it indicates the deviation from the average. The smaller the better.

In this test, the standard deviation of the server is 4820 which is high. We need to improve the server to reduce the standard deviation value.

NOTE: The above values depend on several factors like current server load , your internet speed, your CPU power etc. Hence, it’s very unlikely that you will get the same results as above. So don’t panic!

Performance Tuning

Performance tuning is the improvement of system performance. Most systems will respond to increased load with some degree of decreasing performance. A system’s ability to accept higher load is called scalability, and modifying a system to handle a higher load is synonymous to performance tuning.

How do we do performance tuning?



Prioritized Tuning Steps

  1. Step 1: Tune the Business Rules.

  2. Step 2: Tune the Data Design.

  3. Step 3: Tune the Application Design.

  4. Step 4: Tune the Logical Structure of the Database.

  5. Step 5: Tune Database Operations.

  6. Step 6: Tune the Access Paths.

  7. Step 7: Tune Memory Allocation.

  8. Step 8: Tune I/O and Physical Structure.

5 →TESTING REPORT AND SUMMARY

For all the testing , the final step is to prepare a report. This is a sample of the report for the tested server above.



Advantages of JMeter

  • Open-source.

  • User-friendly.

  • Recording.

Drawbacks of JMeter

  • Scripting.

  • Protocol Support.

  • Scaling Large load Tests.

Troubleshooting

If you face the issue while running the above scenario … do the following

  1. Check whether you are connecting to the internet via a proxy. If yes, remove the proxy.

  2. Open a new instance of JMeter

  3. Open the PerformanceTestPlan.jmx in Jmeter

  4. Double Click on Thread Group -> Graph Result

  5. Run the Test

43 views0 comments

Recent Posts

See All