n8n/packages/@n8n/benchmark
2024-08-28 10:46:17 +03:00
..
bin feat: Add n8n-benchmark cli (no-changelog) (#10410) 2024-08-22 11:33:11 +03:00
infra feat: Benchmark env with run scripts (no-changelog) (#10477) 2024-08-23 14:43:26 +03:00
scenarios feat: Add n8n-benchmark cli (no-changelog) (#10410) 2024-08-22 11:33:11 +03:00
scripts fix: Fix scenario prefix not being passed (no-changelog) (#10575) 2024-08-28 10:46:17 +03:00
src fix: Fix scenario prefix not being passed (no-changelog) (#10575) 2024-08-28 10:46:17 +03:00
.eslintrc.js feat: Report benchmark results (no-changelog) (#10534) 2024-08-23 16:59:19 +03:00
.gitignore feat: Benchmark env with run scripts (no-changelog) (#10477) 2024-08-23 14:43:26 +03:00
Dockerfile feat: Add n8n-benchmark cli (no-changelog) (#10410) 2024-08-22 11:33:11 +03:00
package.json feat: Benchmark env with run scripts (no-changelog) (#10477) 2024-08-23 14:43:26 +03:00
README.md feat: Benchmark env with run scripts (no-changelog) (#10477) 2024-08-23 14:43:26 +03:00
tsconfig.build.json feat: Add n8n-benchmark cli (no-changelog) (#10410) 2024-08-22 11:33:11 +03:00
tsconfig.json feat: Add n8n-benchmark cli (no-changelog) (#10410) 2024-08-22 11:33:11 +03:00

n8n benchmarking tool

Tool for executing benchmarks against an n8n instance.

Running 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

Running 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

# If you installed k6 using brew, you might have to specify it explicitly
K6_PATH=/opt/homebrew/bin/k6 N8N_USER_EMAIL=user@n8n.io N8N_USER_PASSWORD=password ./bin/n8n-benchmark run

Running in the cloud

There's a script to run the performance tests in a cloud environment. The script provisions a cloud environment, sets up n8n in the environment, runs the tests and destroys the environment.

pnpm run-in-cloud

Configuration

The configuration options the cli accepts can be seen from config.ts

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.