Kong Gateway Performance Testing
The framework is implemented as an extension to Kong’s integration test suite.
The framework uses and some Lua development dependencies of Kong. To set up the environment, run on your Kong repository to install all Lua dependencies.
Install Lua development dependencies of Kong being installed and invoke each test file with busted
. The following runs the RPS and latency test using the docker
driver.
By default, Terraform doesn’t teardown instances after each test in lazy_teardown
, allowing users to run multiple tests consecutively without rebuilding the infrastructure each time.
When using the driver and aws-ec2
as the provider, AWS credentials can be provided using environment variables. It’s common to pass the AWS_PROFILE
variable to point to a stored AWS credentials profile, or AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
to use credentials directly. See the Terraform AWS provider document for further information.
Charts are not rendered by default. There’s a reference implementation to draw graphs on all JSON data stored in the directory. Use the following commands to draw graphs:
Three “drivers” are implemented depending on different environments, accuracy requirements, and setup complexity.
You must install the following Lua development dependencies to use either of the drivers:
terraform Driver runs in a remote VM or on a bare metal machine. It’s most accurate, but it requires Terraform knowledge to operate and setup.
- Requires git binary if testing between git commits. When testing between git commits, the framework assumes the current directory is Kong’s repo. It will stash your working directory and remove the stash after the test is finished. When using the Docker or Terraform driver, the framework derives the base version of each commit and uses the matching Docker image or Kong binary package and puts the local source code inside.
Multiple test cases can share the same Lua file.
The following code snippet demonstrates a basic workflow for defining a workload and load testing Kong.
The test can be run as a normal Busted test, using bin/busted path/to/this_file_spec.lua
.
With samples in , the RPS and latency results, Kong error logs, charts and Flame Graph files are saved to the output
directory in the current directory.