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.
- 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.
- Go 1.16 or later
- A valid n8n webhook endpoint
-
Clone the repository:
git clone <repository-url> cd n8n-loadtest
-
Create a
url
file containing the webhook endpoint:https://n8n.northshoreautomation.com/webhook/aff15955-f09c-4172-9bd5-50eba7620019
-
Create a
payload
file containing the JSON payload:{ "data": [ {"key1": "value1", "key2": "value2"}, {"key3": "value3", "key4": "value4"} ] }
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.
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.
To send 10 requests per second:
go run main.go -c 10
To send unlimited requests:
go run main.go
- 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.
- Ensure the
url
andpayload
files are in the same directory asmain.go
. - Use this tool responsibly to avoid overloading the target server.