n8n/packages/@n8n/benchmark
2025-06-27 10:29:41 +03:00
..
bin feat: Add n8n-benchmark cli (no-changelog) (#10410) 2024-08-22 11:33:11 +03:00
infra chore(benchmark): Increase benchmark vm disk size from 16 to 32 (#14501) 2025-04-10 11:04:22 +02:00
scenarios perf(core): Batch raw insights save and add metadata cache (#14261) 2025-04-07 18:18:11 +02:00
scripts chore(benchmark): Don't enable insights in the default benchmarks (#15415) 2025-05-15 12:17:43 +02:00
src test: Add option to specify the out param in benchmark cli (#16754) 2025-06-27 10:29:41 +03:00
.eslintrc.js refactor: Move vitest-config and eslint-config packages to @n8n (#13530) 2025-02-26 14:45:35 +02:00
.gitignore feat: Benchmark env with run scripts (no-changelog) (#10477) 2024-08-23 14:43:26 +03:00
biome.jsonc ci: Setup biome and pre-commit hooks for formatting (no-changelog) (#10795) 2024-09-17 15:10:22 +03:00
Dockerfile ci: Use node.js 22 by default. Add initial support for node.js 24 (#16018) 2025-06-04 17:49:31 +02:00
package.json 🚀 Release 1.99.0 (#16381) 2025-06-16 15:44:12 +03:00
README.md docs: Update benchmark README file to fix secenario filter (no-changelog) (#11680) 2025-01-22 12:38:24 +01:00
tsconfig.build.json refactor: Move tsconfig.*.json files to separate npm package (no-changelog) (#13426) 2025-02-25 20:45:50 +02:00
tsconfig.json refactor: Move tsconfig.*.json files to separate npm package (no-changelog) (#13426) 2025-02-25 20:45:50 +02:00

n8n benchmarking tool

Tool for executing benchmarks against an n8n instance.

Directory structure

packages/@n8n/benchmark
├── scenarios        Benchmark scenarios
├── src              Source code for the n8n-benchmark cli
├── Dockerfile       Dockerfile for the n8n-benchmark cli
├── scripts          Orchestration scripts

Benchmarking an existing n8n instance

The easiest way to run the existing benchmark scenarios is to use the benchmark docker image:

docker pull ghcr.io/n8n-io/n8n-benchmark:latest
# Print the help to list all available flags
docker run ghcr.io/n8n-io/n8n-benchmark:latest run --help
# Run all available benchmark scenarios for 1 minute with 5 concurrent requests
docker run ghcr.io/n8n-io/n8n-benchmark:latest run \
	--n8nBaseUrl=https://instance.url \
	--n8nUserEmail=InstanceOwner@email.com \
	--n8nUserPassword=InstanceOwnerPassword \
	--vus=5 \
	--duration=1m \
	--scenarioFilter=single-webhook

Using custom scenarios with the Docker image

It is also possible to create your own benchmark scenarios and load them using the --testScenariosPath flag:

# Assuming your scenarios are located in `./scenarios`, mount them into `/scenarios` in the container
docker run -v ./scenarios:/scenarios ghcr.io/n8n-io/n8n-benchmark:latest run \
	--n8nBaseUrl=https://instance.url \
	--n8nUserEmail=InstanceOwner@email.com \
	--n8nUserPassword=InstanceOwnerPassword \
	--vus=5 \
	--duration=1m \
	--testScenariosPath=/scenarios

Running the entire benchmark suite

The benchmark suite consists of benchmark scenarios and different n8n setups.

locally

pnpm benchmark-locally

In the cloud

pnpm benchmark-in-cloud

Running the n8n-benchmark cli

The n8n-benchmark cli is a node.js program that runs one or more scenarios against a single n8n instance.

Locally with Docker

Build the Docker image:

# Must be run in the repository root
# k6 doesn't have an arm64 build available for linux, we need to build against amd64
docker build --platform linux/amd64 -t n8n-benchmark -f packages/@n8n/benchmark/Dockerfile .

Run the image

docker run \
  -e N8N_USER_EMAIL=user@n8n.io \
  -e N8N_USER_PASSWORD=password \
  # For macos, n8n running outside docker
  -e N8N_BASE_URL=http://host.docker.internal:5678 \
  n8n-benchmark

Locally without Docker

Requirements:

  • k6
  • Node.js v20 or higher
pnpm build

# Run tests against http://localhost:5678 with specified email and password
N8N_USER_EMAIL=user@n8n.io N8N_USER_PASSWORD=password ./bin/n8n-benchmark run

Benchmark scenarios

A benchmark scenario defines one or multiple steps to execute and measure. It consists of:

  • Manifest file which describes and configures the scenario
  • Any test data that is imported before the scenario is run
  • A k6 script which executes the steps and receives API_BASE_URL environment variable in runtime.

Available scenarios are located in ./scenarios.

n8n setups

A n8n setup defines a single n8n runtime configuration using Docker compose. Different n8n setups are located in ./scripts/n8nSetups.