n8n/packages/@n8n/benchmark
github-actions[bot] d78ab2983a
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
🚀 Release 1.63.0 (#11190)
Co-authored-by: fedme <3295133+fedme@users.noreply.github.com>
2024-10-09 18:30:19 +02:00
..
bin feat: Add n8n-benchmark cli (no-changelog) (#10410) 2024-08-22 11:33:11 +03:00
infra ci: Remove benchmark VM entra login (#10679) 2024-09-05 13:57:09 +03:00
scenarios refactor(benchmark): Expand js code node benchmark (#11052) 2024-10-02 12:04:53 +03:00
scripts fix(benchmark): Pin redis and postgres versions (#11131) 2024-10-07 13:23:32 +03:00
src fix(benchmark): Simplify binary data scenario setup and use larger binary file (#10879) 2024-09-19 16:21:55 +03:00
.eslintrc.js refactor(benchmark): Use kebab-case for file and directory names (#10787) 2024-09-12 16:06:43 +03: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 build(benchmark): Fix docker image build (#10854) 2024-09-17 17:37:07 +03:00
package.json 🚀 Release 1.63.0 (#11190) 2024-10-09 18:30:19 +02:00
README.md ci: Fix script name in gh workflow (#10619) 2024-08-30 10:48:34 +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. The tool consists of these components:

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

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.