Skip to content

Set Node Expressions Benchmark

A performance testing workflow that demonstrates various expression patterns in n8n's Set node, designed to benchmark how different types of data transformations and field assignments perform under load.

Purpose

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

This workflow appears to be a technical benchmark for testing the performance characteristics of n8n's expression engine, particularly focusing on how the Set node handles different types of field assignments and data transformations.

How It Works

  1. Webhook receives POST request - The workflow starts when a POST request is made to the /set-expressions-benchmark endpoint
  2. Data transformation testing - The Edit Fields node processes the incoming webhook data using six different expression patterns to test various performance scenarios
  3. Response delivery - All processed data is returned to the caller via the webhook response

The workflow tests multiple expression types including simple field copying, dynamic key generation, string concatenation, static values, object manipulation, and array creation.

Workflow Diagram

graph TD
    A[Webhook] --> B[Edit Fields]
    B --> C[Respond to Webhook]

Trigger

Webhook (POST): Listens for POST requests at the /set-expressions-benchmark endpoint. The webhook is configured to use a response node, meaning it will wait for the workflow to complete before sending a response back to the caller.

Nodes Used

Node Type Node Name Purpose
Webhook Webhook Receives POST requests and triggers the workflow
Set Edit Fields Performs various data transformations using different expression patterns
Respond to Webhook Respond to Webhook Returns all processed items back to the webhook caller

External Services & Credentials Required

No external services or credentials are required for this workflow. It operates entirely within n8n using built-in nodes.

Environment Variables

No environment variables are required for this workflow.

Data Flow

Input: POST request to webhook endpoint with any JSON payload (typically containing headers and other request metadata)

Processing: The Edit Fields node creates six new fields using different expression patterns: - oneToOneCopy: Direct field copy ($json.headers.host) - Dynamic key from expression: Uses user-agent substring as field name - Multiple variables: Concatenates execution mode and webhook URL - Static value: Sets a fixed number (42) - Object: Copies the entire headers object - Array: Converts header values to an array

Output: JSON object containing all original data plus the six new transformed fields

Error Handling

This workflow does not implement explicit error handling. If any expressions fail to evaluate or if the webhook receives malformed data, n8n's default error handling will apply, potentially causing the workflow execution to fail.

Known Limitations

No specific limitations documented in the business context.

No related workflows specified in the business context.

Setup Instructions

  1. Import the workflow into your n8n instance
  2. Activate the workflow to enable the webhook endpoint
  3. Test the endpoint by sending a POST request to https://your-n8n-instance.com/webhook/set-expressions-benchmark
  4. Monitor performance by sending requests with varying payload sizes and complexity to benchmark expression performance

Example Test Request

1
2
3
4
curl -X POST https://your-n8n-instance.com/webhook/set-expressions-benchmark \
  -H "Content-Type: application/json" \
  -H "User-Agent: TestAgent/1.0" \
  -d '{"test": "data"}'

The workflow will process the request and return the original data along with the six computed fields based on the request headers and metadata.