Performing A Load Testing On Web APIs Using Apache j-Meter


We have been using and writing web APIs in Node.js using express framework. Our web APIs could be used by various web or mobile clients like android app or iOS app or a web application. That’s why web APIs are becoming key components for our applications and for that web APIs should perform flawlessly. APIs are helping us to connect millions of clients with the growing business requirements.
Performance matters a great deal, and more so in a world of micro services, which means the source of what a client application shows is probably being aggregated from multiple APIs behind the scenes. Generally, our web APIs have several end points but in production may or may not work under same load. For Web APIs, the way to check performance is load/ stress testing.

In this article we will be focusing on some tools which can help us to perform load testing on our application. We will also be looking over some bench marks which will help us in evaluating our endpoints.

Load Testing Intro

Load testing is also an important component when we are writing web APIs for organizations. It essentially means testing our APIs against several simultaneous requests and their responses. Sometimes we do have a requirement to carry out transaction type of queries while writing web APIs. So it is essential that we carry out load testing on applications before making it to production.
Today we will be using apache j-meter for Load testing our Node.js application. J-meter is java based testing software which provides good UI which is very easy to work with.

Project setup

  • Node.js application for running WEB APIs
  • Apache j-meter – should be downloaded

Cloning sample Web API Repository

Clone our sample Node.js application which has built in basic operation. Given application is using MySql, Express.js, Sequlize as ORM. Once you have cloned your node application, you need to install all dependencies needed for the application. We have api description

Get /api/books
fetches all books

Get /api/book/id
fetch one book with given id

POST /api/book
Adds the book details. Book details should be sent by HTTP Body in JSON format

PUT /api/book/id
Modify book details with given id. Book details should be sent by HTTP Body in JSON format.

DELETE /api/book/id
Deletes the book with mentioned id.

JMeter configuration

You should have downloaded j-meter on your local machine and as this is a java application, you should have java installed. JMeter requires a fully compliant JVM 6 or higher. You need to unzip the downloaded content and run jmeter.bat which will start your j-meter software

Getting started with Load testing

Once you have your APIs ready we can get started with load testing on APIs. You need to start your API server and if you don’t have APIs ready then use our sample APIs in Node.js. If you are using our sample API Node.js Application, then start the server by

Node server.js

  1. Creating a sample request in J-meter
    Start you j-meter application by running “jmeter.bat”. You will see this screen if you j-meter is successfully started.

  2. Create a thread group under TEST PLAN which is under Threads.


    We have created acc thread group where we can write no. of threads (users) and ramp up periods. You can understand thread group as number of requests which will be sent simultaneously and Ramp Up period as the amount of time taken to start the number of threads for a particular request.

  3. Add a HTTP Header Manager under thread group and add header as shown.


  4. Add HTTP Request under thread group and could be found under Sampler. You can add your request details. We will add GET request for our sample APIs.


  5. Add a Listener of type VIEW RESULTS TREE for you requests. We will be seeing all our response here


  6. Test your application for 1 request by clicking on play icon. You can see your output in VIEW RESULTS TREE. Once you have made 1 successful request, you are all set for load testing on your API for your application.