Skip to content

JS Code Node Benchmark Workflow

This workflow serves as a performance testing tool for JavaScript code execution in n8n, generating synthetic user data and processing it through different code node configurations to measure execution times and resource usage.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

This workflow appears to be designed for benchmarking JavaScript code node performance in n8n by generating test data and processing it through different execution modes.

How It Works

  1. Webhook Trigger: Receives a POST request to start the benchmark test
  2. Data Generation: Creates 100 synthetic user records with random personal information
  3. Data Processing: Processes each record individually, adding computed fields and masking sensitive data
  4. Response: Returns all processed records back to the caller

The workflow demonstrates both bulk data generation and item-by-item processing patterns commonly used in n8n workflows.

Workflow Diagram

graph TD
    A[Webhook] --> B[Code - Generate Data]
    B --> C[OnceForEachItemJSCode]
    C --> D[Respond to Webhook]

Trigger

Webhook - POST endpoint at /code-node-benchmark - Accepts POST requests to initiate the benchmark - No specific input data required - Configured to use response node for output

Nodes Used

Node Type Node Name Purpose
Webhook Webhook Receives POST requests to trigger the benchmark
Code Code Generates 100 synthetic user records with random data
Code OnceForEachItemJSCode Processes each user record individually (adds age, masks password, removes lastname, parses email)
Respond to Webhook Respond to Webhook Returns all processed items to the webhook caller

External Services & Credentials Required

None - this workflow is entirely self-contained and doesn't require external API connections or credentials.

Environment Variables

No environment variables are required for this workflow.

Data Flow

Input: Empty POST request to webhook endpoint

Processing: - Generates 100 user objects with fields: uid, email, firstname, lastname, password - For each user record: - Adds random age (10-40 years) - Masks password with asterisks - Removes lastname field - Adds emailData object with parsed email components

Output: Array of 100 processed user objects with structure:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
{
  "uid": "12345678-1234-1234-1234-12345678",
  "email": "abcdefgh@klmnopqrst.com",
  "firstname": "abcde",
  "password": "**********",
  "age": 25,
  "emailData": {
    "user": "abcdefgh",
    "domain": "klmnopqrst.com"
  }
}

Error Handling

No explicit error handling is implemented in this workflow. Errors would bubble up through n8n's default error handling mechanisms.

Known Limitations

  • Fixed to generate exactly 100 records per execution
  • No input validation on the webhook
  • Password masking assumes all passwords are the same length
  • No error handling for malformed email addresses

No related workflows specified.

Setup Instructions

  1. Import the Workflow

    • Copy the workflow JSON
    • In n8n, go to Workflows → Import from JSON
    • Paste the JSON and save
  2. Activate the Workflow

    • Click the "Active" toggle to enable the webhook
  3. Test the Workflow

    • Note the webhook URL from the Webhook node
    • Send a POST request to the endpoint:
      1
      curl -X POST [your-n8n-instance]/webhook/code-node-benchmark
      
  4. Monitor Performance

    • Check execution times in the workflow execution history
    • Monitor resource usage during execution
    • Compare performance across different n8n versions or configurations

No additional configuration or credentials are required for this benchmark workflow.