Getting Started with Predator – ruthless API performance testing

There are lot of tools, solutions, and framework is available for performance testing. The most well-known tools such as Apache JMeter, Micro Focus LoadRunner, Gatling, Neotys NeoLoad etc., has large user base and community. When I was browsing thru chaos engineering, I landed to predator.dev page accidentally. Later I spent half-a-day to explore about Predator and its features. This blog will feature Predator and how to get started with performance testing using Docker.

What is Predator?

Predator is free, open-source, and distributed load testing tool especially for APIs performance testing. The team behind Predator is PayU. Predator supports installation in Docker, Kubernetes, and DC/OS.

You can run unlimited tests using unlimited resources with unlimited threads/virtual users. Because you will be using your own infrastructure for performance testing.

I am not going to compare Predator with other tools’ features. Each tool comes with its own set of features and limitations.

More technical definition

Predator is an open-source performance framework we created for ourselves. We were fed up with the limitations of out-of-the-box solutions and the complication of writing complex custom tests. We designed Predator to manage the entire lifecycle of stress-testing a server, from creating a test file, to running scheduled and on-demand tests, and finally viewing the test results. Bootstrapped with a user-friendly UI alongside a simple REST API, Predator helps developers simplify the performance testing regime.

On-boarding

Installing Predator is quite simple if you are already experienced in Docker or k8s or DC/OS.

For Docker:

w/o persistent storage, fire the below command

docker run -d -e JOB_PLATFORM=DOCKER -e INTERNAL_ADDRESS=http://$MACHINE_IP:80/v1 -p 80:80 --name predator -v /var/run/docker.sock:/var/run/docker.sock zooz/predator

w/ persistent storage, use

docker run -d -e SQLITE_STORAGE=db/predator -e JOB_PLATFORM=DOCKER -e INTERNAL_ADDRESS=http://$MACHINE_IP:80/v1 -p 80:80 --name predator -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/predator:/usr/db zooz/predator

After successful installation, you can access the UI at http://localhost/UI or http://{$MACHINE_IP}/ui

For Kubernetes:

You can install Predator using the Helm.

helm repo add zooz https://zooz.github.io/helm/

helm install zooz/predator --version 1.3

For DC/OS:

Install thru Universe https://universe.dcos.io/#/package/predator/version/latest within the cluster.

Getting Started

To get started, I will be running Predator in Docker in Windows 10 Pro. After successful installation, Predator will be up and running in http://localhost/ui

Getting Started with Predator - ruthless API performance testing
Getting Started with Predator – ruthless API performance testing

This is how homepage looks. The user interface is built using React framework.

Predator Home Page
Predator Home Page

Before you start your first test, make sure the Settings are properly configured. Internal address should point to local IP address if you are running Predator locally.

Predator Configuration
Predator Configuration

In Settings page, you can configure Benchmarks, SMTP, Metrics, Resource configuration, and you can also do housekeeping the containers.

Sample Demo Application

Before we begin creating our first test, let us install sample pet store from Swagger docker.

docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_URL=http://localhost -e SWAGGER_BASE_PATH=/v2 -p 3001:8080 swaggerapi/petstore

I am using the port 3001 to install the Swagger pet store. Below is my sample API call to the pet’s details.

Sample Demo
Sample Demo

Predator does come with sample pet store docker image. But for me it did not work, hence I installed Swagger pet store.

First Test

To create your first test, click on Tests and then click on Create Test.

Predator Tests
Predator Tests

Let us test our demo API http://{machineip}:3001/v2/pet/10 by configuring below details in Test and then hit Submit. This will create a test and displays it in the Tests page.

You can create multiple scenarios and multiple API calls based on your test strategy.

Create Test in Predator
Create Test in Predator

To run the test, click on Run button as shown below. Predator uses jobs to execute the test.

Run Predator Test
Run Predator Test

Configure below job details and then clicking on Submit will trigger the test immediately.

Predator Job
Predator Job

Launch powershell or command prompt and issue docker ps command to see the running containers. Predator will create a container which will execute the tests.

Predator Running Container
Predator Running Container

Viewing Report

During the test run or after its completed, you can view the report in Last Reports page. Click on View button on the appropriate test name as shown below.

Viewing report
Viewing report

Sample report

Predator Report
Predator Report

In next blog we will see more details like architecture, Predator background, advanced features in detail. Please let me know if you have any questions. Happy to help you.

About the Author

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hamster - Launch JMeter Recent Test Plans SwiftlyDownload for free
+
Share via
Copy link