Establish a Kong Gateway performance testing benchmark

Uses: Kong Gateway Kong Ingress Controller

You can establish a baseline for performance by running a benchmark of Kong Gateway.

After running a benchmark, you can optimize Kong Gateway performance by reviewing and adjusting Kong Gateway configuration based on our performance recommendations.

Prerequisites

You must have Kong Gateway 3.4.2.0 or later.

Before you conduct a benchmark test, make sure the testbed is configured correctly. Here are a few general recommendations before you begin the benchmark tests:

  • Use fewer nodes of Kong Gateway with 4 or 8 Nginx workers with corresponding CPU resource allocations rather than many smaller Kong Gateway nodes.
  • Run Kong Gateway in DB-less or hybrid mode. In these modes, Kong Gateway’s proxy nodes aren’t connected to a database, which can become another variable that might affect performance.

You can use Kong Gateway’s public test suite to perform your own benchmarks.

Perform a baseline Kong Gateway performance benchmark

Once you have implemented the recommendations in the prerequisites, you can begin the benchmark test:

  1. Configure a Route with a Request Termination plugin and measure Kong Gateway’s performance. In this case, Kong Gateway responds to the request and doesn’t send any traffic to the upstream server.
  2. Run this test a few times to spot unexpected bottlenecks. Either Kong Gateway, the benchmarking client (such as k6 or Apache JMeter), or some other component will likely be an unexpected bottleneck. You should not expect higher performance from Kong Gateway until you solve these bottlenecks. Proceed to the next step only after this baseline performance is acceptable to you.
  3. Once you have established the baseline, configure a Route to send traffic to the upstream server without any plugins. This measures Kong Gateway’s proxy and your upstream server’s performance.
  4. Verify that no components are unexpectedly causing a bottleneck before proceeding.
  5. Run the benchmark multiple times to gain confidence in the data. Ensure that the difference between observations isn’t high (there’s a low standard deviation).
  6. Discard the stats collected by the benchmark’s first one or two iterations. We recommend doing this to ensure that the system is operating at an optimal and stable level.

After these steps are completed, proceed with benchmarking Kong Gateway with additional configuration.

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!