Skip to content

jacobnollette/n8n-loadtest

Repository files navigation

n8n-loadtest

n8n-loadtest is a Go-based command-line application designed to load test an n8n incoming webhook node by sending JSON payloads via POST requests. The application supports optional throttling to control the number of requests per second.

Features

  • Reads the webhook endpoint from a url file.
  • Reads the JSON payload from a payload file.
  • Sends infinite POST requests to the specified endpoint.
  • Supports optional throttling via a command-line argument.
  • Displays statistics and estimated results upon exit.

Prerequisites

  • Go 1.16 or later
  • A valid n8n webhook endpoint

Setup

  1. Clone the repository:

    git clone <repository-url>
    cd n8n-loadtest
  2. Create a url file containing the webhook endpoint:

    https://n8n.northshoreautomation.com/webhook/aff15955-f09c-4172-9bd5-50eba7620019
    
  3. Create a payload file containing the JSON payload:

    {
      "data": [
        {"key1": "value1", "key2": "value2"},
        {"key3": "value3", "key4": "value4"}
      ]
    }

Usage

Run the application with the following command:

go run main.go [requests-per-second]
  • Replace [requests-per-second] with the desired number of requests per second to throttle the connections.
  • If no argument is provided, the application will send unlimited requests.

Run Parameters

The application supports the following command-line parameters:

  • -c: Specifies the number of concurrent connections. For example, -c 10 will run 10 concurrent requests.
  • -t: Specifies the duration for the load test. The duration can be specified in seconds (s), minutes (m), or hours (h). For example, -t 1m will run the test for 1 minute.

If neither parameter is provided, the application will send unlimited requests without any concurrency or time limit.

Example

To send 10 requests per second:

go run main.go -c 10

To send unlimited requests:

go run main.go

Exiting the Application

  • Use Ctrl+C to gracefully exit the application.
  • Upon exit, the application will display statistics, including total requests, successful requests, failed requests, elapsed time, and an estimated hourly rate.

Notes

  • Ensure the url and payload files are in the same directory as main.go.
  • Use this tool responsibly to avoid overloading the target server.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published