Some APIs that you develop will have strict performance requirements.
With integrated API Statistics and a mass API test tool you can discover potential bottlenecks within your business logic, database indexes, and even application infrastructure.
Performance testing is similar to manual testing, with a key difference of using a tool to call your API in mass and under different scenarios.
Load testing and stress testing are other types of tests you can perform to find the benchmarks of your application infrastructure.
A useful tool for stress testing and determining benchmarks is Artillery, which allows mass calling of your APIs along with configurable scenarios.
Artillery is a free node package that you install on your local computer like this:
It can be used in a variety ways. Here are a couple quick ways to use it from a terminal:
This will start 20 connections (sessions), and on each connection it will call your API 100 times, 1 at a time.
This is a good example for performance testing, and can tell you the overall throughput of your API
This will run for for 60 seconds, and each second 20 API calls are attempted
This is good example for load or stress testing and can tell you how well this API will stand up under pressure.
The Artillery output provides metrics on these tests, which include:
With the mass tests running or finished, you can take a look at the API statistics:
At the top-right corner of this tab, there are refresh buttons. They allow you to refresh now, pause auto-refresh, auto-refresh every 1 second, 10 seconds, 30 seconds and every minute.
These statistics are collected automatically through the Profound.js service.
Below is an example of API file customer.api.json file, with the Get one customers API selected.
From this test view, you can see a lot of information. Some of the interesting statistics include: