Performance Testing using Apache JMeter

Introduction

How our application is performing is a very core question in software development. In this post we will have a basic overview of performance testing, its various types and introduction of JMeter which is one of the most popular performance testing tool in industry. We will be using it to do performance testing of a web application.

Let’s learn a little bit about performance testing next:

Performance Testing

Performance is usually related to “how fast an application executes an operation“.

Performance testing is not only about measuring speed only. In particular performance is measured in terms of:

  • Response Time (response time + processing time + network latency)
  • Throughput (Nos. of transactions i.e. request/response per unit of time (e.g. million/sec).
  • Reliability (i.e. no of errors / no. of requests)
  • Scalability (i.e. response time + throughput + percentage of error)

Performance Requirement Examples

Few examples as follows:

  • The average/max response time should be 800 ms.
  • The system shall be able to support 60 pages/second.
  • The system shall be capable of supporting 1000 users per hour.

Performance Testing Process

Design and Build Tests:

For this you have to know the application and its usage pattern e.g.

  • how many product reviews are we expecting per hour or
  • on average how many users will be browsing the product catalogue at any give time .

This knowledge will help in testing.

Prepare the Test Environment:

  • Prepare a test environment (similar to production).

Run the Tests

  • Monitor logs / test results.

Analyze/Optimize the Results

  • Find issues, optimize etc.

Retest

  • After changes repeat the process.

Type of performance Tests

Performance tests evaluate an application under certain amount of load, but different type of tests generate the load in different ways:

  • By increasing the number of users that access the app same time.
  • By increasing the number of requests that application has to handle independently of number of users.
  • Smoke Tests (Tests with light load) – Usually one user to verify that test work correctly.
  • Load Test – Test performed at specific load level (test at many load levels).
  • Stress Test – Test go beyond normal loading scenario to see up to which point it stays stable (responsive) e.g. add load in steps.
  • Spike Test: Application is subjected to brief periods of sudden increments in the load beyond its max capacity to see if the app is robust enough to deal with spikes.
  • Endurance Test: Where app is subjected to load within its limits but for a long duration, hours or in some cases days to see if app has some memory leaks or not closing database connections properly etc.

JMeter Tool

Apache JMeter is an open source software and It can be used to simulate loads of various scenarios and output performance data in several ways, including CSV and XML files, and graphs. 

JMeter is a load/performance testing tool.

JMeter is one of the most popular performance testing tool in the industry. It tests how an application or a resource like database, performs under a given load to see its impact. It can help to locate and resolve performance bottlenecks.

It is not a UI testing tool (JMeter is not a browser. it does not execute JavaScript).

Think of JMeter as a tool to perform multiple server requests.

Installation Setups:

Install JAVA

  • https://www.oracle.com/java/technologies/javase-downloads.html

Download JMeter

Starting JMeter

On windows, unzip the downloaded file and you can double-click jmeter.bat file as shown below:

It will output similar to picture below

Here is the JMeter UI

Here is another screen shows HTTP Request setup:

In the next post on this topic, we will be covering various JMeter constructs, terminologies, configurations and start building performance test suite for our application.

Summary

In this post, we covered some basics of performance testing, what does it mean and why its useful. We also covered different type of load tests which can be performed using JMeter. We also saw how to install and run JMeter on windows machine.

In the next post on this topic, we will be writing some performance tests to see all this in action. Let me know if you have some comments or questions. Till next time, Happy Coding.

My Recent Books

1 thought on “Performance Testing using Apache JMeter”

Comments are closed.