Python Code Node Benchmark¶
This workflow serves as a performance testing tool for n8n's Python Code node capabilities. It generates synthetic user data, processes it through Python transformations, and returns the results via webhook response to measure execution speed and data handling efficiency.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
How It Works¶
- Webhook Trigger: Accepts POST requests to initiate the benchmark test
- Data Generation: Creates 100 synthetic user records with random UIDs, emails, names, and passwords using Python
- Data Processing: Transforms each user record individually by adding age fields, masking passwords, removing last names, and extracting email components
- Response: Returns all processed records back to the caller via webhook response
Workflow Diagram¶
graph TD
A[Webhook] --> B[Code - Generate Data]
B --> C[OnceForEachItemPythonCode]
C --> D[Respond to Webhook]
Trigger¶
Webhook: POST endpoint at /py-code-node-benchmark
- Method: POST
- No authentication required
- Accepts any payload (payload is ignored)
Nodes Used¶
| Node Type | Node Name | Purpose |
|---|---|---|
| Webhook | Webhook | Receives POST requests to start the benchmark |
| Code (Python) | Code | Generates 100 synthetic user records with random data |
| Code (Python) | OnceForEachItemPythonCode | Processes each user record individually with transformations |
| Respond to Webhook | Respond to Webhook | Returns all processed items to the webhook caller |
External Services & Credentials Required¶
None - this workflow is self-contained and doesn't require external API connections or credentials.
Environment Variables¶
None required.
Data Flow¶
Input: Any POST request to the webhook endpoint (payload ignored)
Output: Array of 100 processed user objects with the following structure:
1 2 3 4 5 6 7 8 9 10 11 | |
Transformations Applied:
- Adds age field (10-40 years, pseudo-randomly generated from email)
- Masks password field with asterisks
- Removes lastname field
- Adds emailData object with parsed email components
Error Handling¶
No explicit error handling is implemented in this workflow. Errors would cause the workflow to fail and return a 500 status code.
Known Limitations¶
- Fixed dataset size of 100 records
- No input validation on webhook requests
- Pseudo-random generation is deterministic based on hash functions
- No error handling for malformed email addresses
- Memory usage scales linearly with dataset size
Related Workflows¶
None specified.
Setup Instructions¶
- Import Workflow: Import the JSON into your n8n instance
- Activate Workflow: Enable the workflow to make the webhook endpoint available
- Test Endpoint: Send a POST request to
https://your-n8n-instance/webhook/py-code-node-benchmark - Monitor Performance: Use the response time and data to benchmark Python Code node performance
Testing with curl:
1 2 3 | |
The workflow will generate 100 user records, process them through Python transformations, and return the results for performance analysis.