@atom8n/n8n-benchmark 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/Dockerfile +63 -0
  3. package/README.md +122 -0
  4. package/bin/n8n-benchmark +13 -0
  5. package/biome.jsonc +7 -0
  6. package/dist/build.tsbuildinfo +1 -0
  7. package/dist/commands/list.d.ts +8 -0
  8. package/dist/commands/list.js +23 -0
  9. package/dist/commands/list.js.map +1 -0
  10. package/dist/commands/run.d.ts +24 -0
  11. package/dist/commands/run.js +128 -0
  12. package/dist/commands/run.js.map +1 -0
  13. package/dist/config/common-flags.d.ts +1 -0
  14. package/dist/config/common-flags.js +9 -0
  15. package/dist/config/common-flags.js.map +1 -0
  16. package/dist/n8n-api-client/authenticated-n8n-api-client.d.ts +15 -0
  17. package/dist/n8n-api-client/authenticated-n8n-api-client.js +67 -0
  18. package/dist/n8n-api-client/authenticated-n8n-api-client.js.map +1 -0
  19. package/dist/n8n-api-client/credentials-api-client.d.ts +9 -0
  20. package/dist/n8n-api-client/credentials-api-client.js +24 -0
  21. package/dist/n8n-api-client/credentials-api-client.js.map +1 -0
  22. package/dist/n8n-api-client/data-table-api-client.d.ts +9 -0
  23. package/dist/n8n-api-client/data-table-api-client.js +23 -0
  24. package/dist/n8n-api-client/data-table-api-client.js.map +1 -0
  25. package/dist/n8n-api-client/n8n-api-client.d.ts +13 -0
  26. package/dist/n8n-api-client/n8n-api-client.js +82 -0
  27. package/dist/n8n-api-client/n8n-api-client.js.map +1 -0
  28. package/dist/n8n-api-client/n8n-api-client.types.d.ts +21 -0
  29. package/dist/n8n-api-client/n8n-api-client.types.js +3 -0
  30. package/dist/n8n-api-client/n8n-api-client.types.js.map +1 -0
  31. package/dist/n8n-api-client/project-api-client.d.ts +6 -0
  32. package/dist/n8n-api-client/project-api-client.js +14 -0
  33. package/dist/n8n-api-client/project-api-client.js.map +1 -0
  34. package/dist/n8n-api-client/workflows-api-client.d.ts +11 -0
  35. package/dist/n8n-api-client/workflows-api-client.js +30 -0
  36. package/dist/n8n-api-client/workflows-api-client.js.map +1 -0
  37. package/dist/scenario/scenario-data-loader.d.ts +13 -0
  38. package/dist/scenario/scenario-data-loader.js +84 -0
  39. package/dist/scenario/scenario-data-loader.js.map +1 -0
  40. package/dist/scenario/scenario-loader.d.ts +7 -0
  41. package/dist/scenario/scenario-loader.js +101 -0
  42. package/dist/scenario/scenario-loader.js.map +1 -0
  43. package/dist/test-execution/app-metrics-poller.d.ts +13 -0
  44. package/dist/test-execution/app-metrics-poller.js +54 -0
  45. package/dist/test-execution/app-metrics-poller.js.map +1 -0
  46. package/dist/test-execution/k6-executor.d.ts +33 -0
  47. package/dist/test-execution/k6-executor.js +120 -0
  48. package/dist/test-execution/k6-executor.js.map +1 -0
  49. package/dist/test-execution/k6-summary.d.ts +82 -0
  50. package/dist/test-execution/k6-summary.js +2 -0
  51. package/dist/test-execution/k6-summary.js.map +1 -0
  52. package/dist/test-execution/prometheus-metrics-parser.d.ts +9 -0
  53. package/dist/test-execution/prometheus-metrics-parser.js +44 -0
  54. package/dist/test-execution/prometheus-metrics-parser.js.map +1 -0
  55. package/dist/test-execution/scenario-data-importer.d.ts +21 -0
  56. package/dist/test-execution/scenario-data-importer.js +108 -0
  57. package/dist/test-execution/scenario-data-importer.js.map +1 -0
  58. package/dist/test-execution/scenario-runner.d.ts +18 -0
  59. package/dist/test-execution/scenario-runner.js +46 -0
  60. package/dist/test-execution/scenario-runner.js.map +1 -0
  61. package/dist/test-execution/test-report.d.ts +56 -0
  62. package/dist/test-execution/test-report.js +65 -0
  63. package/dist/test-execution/test-report.js.map +1 -0
  64. package/dist/types/scenario.d.ts +16 -0
  65. package/dist/types/scenario.js +3 -0
  66. package/dist/types/scenario.js.map +1 -0
  67. package/eslint.config.mjs +22 -0
  68. package/infra/.terraform.lock.hcl +60 -0
  69. package/infra/benchmark-env.tf +54 -0
  70. package/infra/modules/benchmark-vm/output.tf +11 -0
  71. package/infra/modules/benchmark-vm/vars.tf +29 -0
  72. package/infra/modules/benchmark-vm/vm.tf +126 -0
  73. package/infra/output.tf +16 -0
  74. package/infra/providers.tf +23 -0
  75. package/infra/vars.tf +34 -0
  76. package/package.json +55 -0
  77. package/scenarios/binary-data/binary-data.json +67 -0
  78. package/scenarios/binary-data/binary-data.manifest.json +7 -0
  79. package/scenarios/binary-data/binary-data.script.js +29 -0
  80. package/scenarios/credential-http-node/credential-bearer.json +8 -0
  81. package/scenarios/credential-http-node/credential-http-node.json +241 -0
  82. package/scenarios/credential-http-node/credential-http-node.manifest.json +10 -0
  83. package/scenarios/credential-http-node/credential-http-node.script.js +30 -0
  84. package/scenarios/data-table-node/data-table-node.json +168 -0
  85. package/scenarios/data-table-node/data-table-node.manifest.json +10 -0
  86. package/scenarios/data-table-node/data-table-node.script.js +38 -0
  87. package/scenarios/data-table-node/data-table.json +25 -0
  88. package/scenarios/http-node/http-node.json +213 -0
  89. package/scenarios/http-node/http-node.manifest.json +7 -0
  90. package/scenarios/http-node/http-node.script.js +30 -0
  91. package/scenarios/js-code-node/js-code-node.json +96 -0
  92. package/scenarios/js-code-node/js-code-node.manifest.json +7 -0
  93. package/scenarios/js-code-node/js-code-node.script.js +29 -0
  94. package/scenarios/multiple-webhooks/multiple-webhooks.manifest.json +20 -0
  95. package/scenarios/multiple-webhooks/multiple-webhooks.script.js +19 -0
  96. package/scenarios/multiple-webhooks/multiple-webhooks1.json +25 -0
  97. package/scenarios/multiple-webhooks/multiple-webhooks10.json +25 -0
  98. package/scenarios/multiple-webhooks/multiple-webhooks2.json +25 -0
  99. package/scenarios/multiple-webhooks/multiple-webhooks3.json +25 -0
  100. package/scenarios/multiple-webhooks/multiple-webhooks4.json +25 -0
  101. package/scenarios/multiple-webhooks/multiple-webhooks5.json +25 -0
  102. package/scenarios/multiple-webhooks/multiple-webhooks6.json +25 -0
  103. package/scenarios/multiple-webhooks/multiple-webhooks7.json +25 -0
  104. package/scenarios/multiple-webhooks/multiple-webhooks8.json +25 -0
  105. package/scenarios/multiple-webhooks/multiple-webhooks9.json +25 -0
  106. package/scenarios/py-code-node/py-code-node.json +98 -0
  107. package/scenarios/py-code-node/py-code-node.manifest.json +7 -0
  108. package/scenarios/py-code-node/py-code-node.script.js +29 -0
  109. package/scenarios/scenario.schema.json +51 -0
  110. package/scenarios/set-node-expressions/set-node-expressions.json +91 -0
  111. package/scenarios/set-node-expressions/set-node-expressions.manifest.json +7 -0
  112. package/scenarios/set-node-expressions/set-node-expressions.script.js +18 -0
  113. package/scenarios/single-webhook/single-webhook.json +25 -0
  114. package/scenarios/single-webhook/single-webhook.manifest.json +7 -0
  115. package/scenarios/single-webhook/single-webhook.script.js +18 -0
  116. package/scripts/bootstrap.sh +63 -0
  117. package/scripts/clients/docker-compose-client.mjs +45 -0
  118. package/scripts/clients/ssh-client.mjs +37 -0
  119. package/scripts/clients/terraform-client.mjs +71 -0
  120. package/scripts/destroy-cloud-env.mjs +86 -0
  121. package/scripts/mock-api/mappings/mockApiData.json +92110 -0
  122. package/scripts/n8n-setups/postgres/docker-compose.yml +76 -0
  123. package/scripts/n8n-setups/postgres/setup.mjs +15 -0
  124. package/scripts/n8n-setups/scaling-multi-main/docker-compose.yml +230 -0
  125. package/scripts/n8n-setups/scaling-multi-main/nginx.conf +24 -0
  126. package/scripts/n8n-setups/scaling-multi-main/setup.mjs +15 -0
  127. package/scripts/n8n-setups/scaling-single-main/docker-compose.yml +174 -0
  128. package/scripts/n8n-setups/scaling-single-main/setup.mjs +15 -0
  129. package/scripts/n8n-setups/sqlite/docker-compose.yml +55 -0
  130. package/scripts/n8n-setups/sqlite/setup.mjs +15 -0
  131. package/scripts/provision-cloud-env.mjs +36 -0
  132. package/scripts/run-for-n8n-setup.mjs +175 -0
  133. package/scripts/run-in-cloud.mjs +167 -0
  134. package/scripts/run-locally.mjs +73 -0
  135. package/scripts/run.mjs +192 -0
  136. package/scripts/utils/flags.mjs +20 -0
  137. package/src/commands/list.ts +26 -0
  138. package/src/commands/run.ts +140 -0
  139. package/src/config/common-flags.ts +6 -0
  140. package/src/n8n-api-client/authenticated-n8n-api-client.ts +88 -0
  141. package/src/n8n-api-client/credentials-api-client.ts +28 -0
  142. package/src/n8n-api-client/data-table-api-client.ts +30 -0
  143. package/src/n8n-api-client/n8n-api-client.ts +85 -0
  144. package/src/n8n-api-client/n8n-api-client.types.ts +27 -0
  145. package/src/n8n-api-client/project-api-client.ts +11 -0
  146. package/src/n8n-api-client/workflows-api-client.ts +38 -0
  147. package/src/scenario/scenario-data-loader.ts +75 -0
  148. package/src/scenario/scenario-loader.ts +90 -0
  149. package/src/test-execution/app-metrics-poller.ts +81 -0
  150. package/src/test-execution/k6-executor.ts +192 -0
  151. package/src/test-execution/k6-summary.ts +255 -0
  152. package/src/test-execution/prometheus-metrics-parser.ts +63 -0
  153. package/src/test-execution/scenario-data-importer.ts +165 -0
  154. package/src/test-execution/scenario-runner.ts +76 -0
  155. package/src/test-execution/test-report.ts +152 -0
  156. package/src/types/scenario.ts +33 -0
  157. package/tsconfig.build.json +9 -0
  158. package/tsconfig.json +14 -0
@@ -0,0 +1,213 @@
1
+ {
2
+ "createdAt": "2024-09-04T07:18:29.011Z",
3
+ "updatedAt": "2024-09-04T07:27:58.000Z",
4
+ "id": "rUXzWNGsUDUmgaFS",
5
+ "name": "HTTP Request",
6
+ "active": false,
7
+ "nodes": [
8
+ {
9
+ "parameters": {
10
+ "httpMethod": "POST",
11
+ "path": "benchmark-http-node",
12
+ "responseMode": "responseNode",
13
+ "options": {}
14
+ },
15
+ "type": "n8n-nodes-base.webhook",
16
+ "typeVersion": 2,
17
+ "position": [-60, 20],
18
+ "id": "f11378b4-5f28-4a6c-9332-5878342cd3cf",
19
+ "name": "Webhook",
20
+ "webhookId": "c40014cc-4d64-4fcf-8c13-9e94b6792756"
21
+ },
22
+ {
23
+ "parameters": {
24
+ "respondWith": "allIncomingItems",
25
+ "options": {}
26
+ },
27
+ "type": "n8n-nodes-base.respondToWebhook",
28
+ "typeVersion": 1.1,
29
+ "position": [1060, 20],
30
+ "id": "f42552c7-9c6e-4616-b9d5-ac79445ef4ed",
31
+ "name": "Respond to Webhook"
32
+ },
33
+ {
34
+ "parameters": {
35
+ "url": "http://mockapi:8080/users/clair.bahringer/received_events/public",
36
+ "options": {
37
+ "response": {
38
+ "response": {
39
+ "fullResponse": true
40
+ }
41
+ }
42
+ }
43
+ },
44
+ "type": "n8n-nodes-base.httpRequest",
45
+ "typeVersion": 4.2,
46
+ "position": [300, -180],
47
+ "id": "20de816e-0fbe-4e28-bc53-f508a2dda117",
48
+ "name": "Mock public received events"
49
+ },
50
+ {
51
+ "parameters": {
52
+ "url": "http://mockapi:8080/repos/udke6pujoywnagxkcvab2riw23khzn2tibo2vincws32qexb50ey7h97d42vnzyol0rxypgsg4pomsf7sgnmdaihstljw8edcijrwmy7mfi76yif19c4/47i31dh737el215j62ts2f2782nw3ss26rul3s8jw13u3vu0xm349a5hyay5asmwnlnf7nx8p9h4g62so6s1cis7xv9puj5j98t4m980sbe2455fn1obccjl/events",
53
+ "options": {
54
+ "response": {
55
+ "response": {
56
+ "fullResponse": true
57
+ }
58
+ }
59
+ }
60
+ },
61
+ "type": "n8n-nodes-base.httpRequest",
62
+ "typeVersion": 4.2,
63
+ "position": [300, 20],
64
+ "id": "083e02b3-a257-49a8-8f7d-42222cb9194c",
65
+ "name": "Mock repository events"
66
+ },
67
+ {
68
+ "parameters": {
69
+ "url": "http://mockapi:8080/orgs/g02pp066qoyithcjevhd6m1wfii3c4x51k39n9apybljhx69/events",
70
+ "options": {
71
+ "response": {
72
+ "response": {
73
+ "fullResponse": true
74
+ }
75
+ }
76
+ }
77
+ },
78
+ "type": "n8n-nodes-base.httpRequest",
79
+ "typeVersion": 4.2,
80
+ "position": [300, 220],
81
+ "id": "f4c3b5d2-0257-4883-a585-ade4c3a1082c",
82
+ "name": "Mock organization events"
83
+ },
84
+ {
85
+ "parameters": {
86
+ "numberInputs": 3
87
+ },
88
+ "type": "n8n-nodes-base.merge",
89
+ "typeVersion": 3,
90
+ "position": [600, 20],
91
+ "id": "273985b7-b0ae-4cde-bbe9-7b3e4b29fe61",
92
+ "name": "Merge"
93
+ },
94
+ {
95
+ "parameters": {
96
+ "assignments": {
97
+ "assignments": [
98
+ {
99
+ "id": "89608adb-f487-416f-a7d8-3ebb1f7b50e5",
100
+ "name": "statusCode",
101
+ "value": "={{ $json.statusCode }}",
102
+ "type": "number"
103
+ }
104
+ ]
105
+ },
106
+ "options": {}
107
+ },
108
+ "id": "231275a7-44e7-47bb-8ccf-fe62dc48356b",
109
+ "name": "Select statusCode",
110
+ "type": "n8n-nodes-base.set",
111
+ "typeVersion": 3.4,
112
+ "position": [820, 20]
113
+ }
114
+ ],
115
+ "connections": {
116
+ "Webhook": {
117
+ "main": [
118
+ [
119
+ {
120
+ "node": "Mock public received events",
121
+ "type": "main",
122
+ "index": 0
123
+ },
124
+ {
125
+ "node": "Mock repository events",
126
+ "type": "main",
127
+ "index": 0
128
+ },
129
+ {
130
+ "node": "Mock organization events",
131
+ "type": "main",
132
+ "index": 0
133
+ }
134
+ ]
135
+ ]
136
+ },
137
+ "Mock public received events": {
138
+ "main": [
139
+ [
140
+ {
141
+ "node": "Merge",
142
+ "type": "main",
143
+ "index": 0
144
+ }
145
+ ]
146
+ ]
147
+ },
148
+ "Mock repository events": {
149
+ "main": [
150
+ [
151
+ {
152
+ "node": "Merge",
153
+ "type": "main",
154
+ "index": 1
155
+ }
156
+ ]
157
+ ]
158
+ },
159
+ "Mock organization events": {
160
+ "main": [
161
+ [
162
+ {
163
+ "node": "Merge",
164
+ "type": "main",
165
+ "index": 2
166
+ }
167
+ ]
168
+ ]
169
+ },
170
+ "Merge": {
171
+ "main": [
172
+ [
173
+ {
174
+ "node": "Select statusCode",
175
+ "type": "main",
176
+ "index": 0
177
+ }
178
+ ]
179
+ ]
180
+ },
181
+ "Select statusCode": {
182
+ "main": [
183
+ [
184
+ {
185
+ "node": "Respond to Webhook",
186
+ "type": "main",
187
+ "index": 0
188
+ }
189
+ ]
190
+ ]
191
+ }
192
+ },
193
+ "settings": { "executionOrder": "v1" },
194
+ "staticData": null,
195
+ "meta": null,
196
+ "pinData": {
197
+ "Webhook": [
198
+ {
199
+ "json": {
200
+ "headers": { "host": "localhost:5678", "user-agent": "curl/8.6.0", "accept": "*/*" },
201
+ "params": {},
202
+ "query": {},
203
+ "body": {},
204
+ "webhookUrl": "http://localhost:5678/webhook-test/benchmark-http-node",
205
+ "executionMode": "test"
206
+ }
207
+ }
208
+ ]
209
+ },
210
+ "versionId": "9fa91e54-e73a-4a34-b781-d64f2b02f333",
211
+ "triggerCount": 0,
212
+ "tags": []
213
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../scenario.schema.json",
3
+ "name": "HttpNode",
4
+ "description": "Webhook -> 3x HTTP request to a mock API -> Merge -> Respond to Webhook. Requires a mock API running at http://mockapi:8080",
5
+ "scenarioData": { "workflowFiles": ["http-node.json"] },
6
+ "scriptPath": "http-node.script.js"
7
+ }
@@ -0,0 +1,30 @@
1
+ import http from 'k6/http';
2
+ import { check } from 'k6';
3
+
4
+ const apiBaseUrl = __ENV.API_BASE_URL;
5
+
6
+ export default function () {
7
+ const res = http.post(`${apiBaseUrl}/webhook/benchmark-http-node`);
8
+
9
+ if (res.status !== 200) {
10
+ console.error(
11
+ `Invalid response. Received status ${res.status}. Body: ${JSON.stringify(res.body)}`,
12
+ );
13
+ }
14
+
15
+ check(res, {
16
+ 'is status 200': (r) => r.status === 200,
17
+ 'http requests were OK': (r) => {
18
+ if (r.status !== 200) return false;
19
+
20
+ try {
21
+ // Response body is an array of the request status codes made with HttpNodes
22
+ const body = JSON.parse(r.body);
23
+ return Array.isArray(body) ? body.every((request) => request.statusCode === 200) : false;
24
+ } catch (error) {
25
+ console.error('Error parsing response body: ', error);
26
+ return false;
27
+ }
28
+ },
29
+ });
30
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "JS Code Node",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": {
9
+ "respondWith": "allIncomingItems",
10
+ "options": {}
11
+ },
12
+ "type": "n8n-nodes-base.respondToWebhook",
13
+ "typeVersion": 1.1,
14
+ "position": [1280, 460],
15
+ "id": "0067e317-09b8-478a-8c50-e19b4c9e294c",
16
+ "name": "Respond to Webhook"
17
+ },
18
+ {
19
+ "parameters": {
20
+ "mode": "runOnceForEachItem",
21
+ "jsCode": "// Add new field\n$input.item.json.age = 10 + Math.floor(Math.random() * 30);\n// Mutate existing field\n$input.item.json.password = $input.item.json.password.split('').map(() => '*').join(\"\")\n// Remove field\ndelete $input.item.json.lastname\n// New object field\nconst emailParts = $input.item.json.email.split(\"@\")\n$input.item.json.emailData = {\n user: emailParts[0],\n domain: emailParts[1]\n}\n\nreturn $input.item;"
22
+ },
23
+ "type": "n8n-nodes-base.code",
24
+ "typeVersion": 2,
25
+ "position": [1040, 460],
26
+ "id": "56d751c0-0d30-43c3-89fa-bebf3a9d436f",
27
+ "name": "OnceForEachItemJSCode"
28
+ },
29
+ {
30
+ "parameters": {
31
+ "httpMethod": "POST",
32
+ "path": "code-node-benchmark",
33
+ "responseMode": "responseNode",
34
+ "options": {}
35
+ },
36
+ "type": "n8n-nodes-base.webhook",
37
+ "typeVersion": 2,
38
+ "position": [580, 460],
39
+ "id": "417d749d-156c-4ffe-86ea-336f702dc5da",
40
+ "name": "Webhook",
41
+ "webhookId": "34ca1895-ccf4-4a4a-8bb8-a042f5edb567"
42
+ },
43
+ {
44
+ "parameters": {
45
+ "jsCode": "const digits = '0123456789';\nconst uppercaseLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';\nconst lowercaseLetters = uppercaseLetters.toLowerCase();\nconst alphabet = [digits, uppercaseLetters, lowercaseLetters].join('').split('')\n\nconst randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\nconst randomItem = (arr) => arr.at(randomInt(0, arr.length - 1))\nconst randomString = (len) => Array.from({ length: len }).map(() => randomItem(alphabet)).join('')\n\nconst randomUid = () => [8,4,4,4,8].map(len => randomString(len)).join(\"-\")\nconst randomEmail = () => `${randomString(8)}@${randomString(10)}.com`\n\nconst randomPerson = () => ({\n uid: randomUid(),\n email: randomEmail(),\n firstname: randomString(5),\n lastname: randomString(12),\n password: randomString(10)\n})\n\nreturn Array.from({ length: 100 }).map(() => ({\n json: randomPerson()\n}))"
46
+ },
47
+ "id": "c30db155-73ca-48b9-8860-c3fe7a0926fb",
48
+ "name": "Code",
49
+ "type": "n8n-nodes-base.code",
50
+ "typeVersion": 2,
51
+ "position": [820, 460]
52
+ }
53
+ ],
54
+ "connections": {
55
+ "OnceForEachItemJSCode": {
56
+ "main": [
57
+ [
58
+ {
59
+ "node": "Respond to Webhook",
60
+ "type": "main",
61
+ "index": 0
62
+ }
63
+ ]
64
+ ]
65
+ },
66
+ "Webhook": {
67
+ "main": [
68
+ [
69
+ {
70
+ "node": "Code",
71
+ "type": "main",
72
+ "index": 0
73
+ }
74
+ ]
75
+ ]
76
+ },
77
+ "Code": {
78
+ "main": [
79
+ [
80
+ {
81
+ "node": "OnceForEachItemJSCode",
82
+ "type": "main",
83
+ "index": 0
84
+ }
85
+ ]
86
+ ]
87
+ }
88
+ },
89
+ "settings": { "executionOrder": "v1" },
90
+ "staticData": null,
91
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
92
+ "pinData": {},
93
+ "versionId": "840a38a1-ba37-433d-9f20-de73f5131a2b",
94
+ "triggerCount": 1,
95
+ "tags": []
96
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../scenario.schema.json",
3
+ "name": "CodeNodeJs",
4
+ "description": "A JS Code Node that first generates 100 items and then runs once for each item and adds, modifies and removes properties. The data is returned with RespondToWebhook Node.",
5
+ "scenarioData": { "workflowFiles": ["js-code-node.json"] },
6
+ "scriptPath": "js-code-node.script.js"
7
+ }
@@ -0,0 +1,29 @@
1
+ import http from 'k6/http';
2
+ import { check } from 'k6';
3
+
4
+ const apiBaseUrl = __ENV.API_BASE_URL;
5
+
6
+ export default function () {
7
+ const res = http.post(`${apiBaseUrl}/webhook/code-node-benchmark`, {});
8
+
9
+ if (res.status !== 200) {
10
+ console.error(
11
+ `Invalid response. Received status ${res.status}. Body: ${JSON.stringify(res.body)}`,
12
+ );
13
+ }
14
+
15
+ check(res, {
16
+ 'is status 200': (r) => r.status === 200,
17
+ 'has items in response': (r) => {
18
+ if (r.status !== 200) return false;
19
+
20
+ try {
21
+ const body = JSON.parse(r.body);
22
+ return Array.isArray(body) ? body.length === 100 : false;
23
+ } catch (error) {
24
+ console.error('Error parsing response body: ', error);
25
+ return false;
26
+ }
27
+ },
28
+ });
29
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "../scenario.schema.json",
3
+ "name": "MultipleWebhooks",
4
+ "description": "10 simple webhooks that respond with a 200 status code",
5
+ "scenarioData": {
6
+ "workflowFiles": [
7
+ "multiple-webhooks1.json",
8
+ "multiple-webhooks2.json",
9
+ "multiple-webhooks3.json",
10
+ "multiple-webhooks4.json",
11
+ "multiple-webhooks5.json",
12
+ "multiple-webhooks6.json",
13
+ "multiple-webhooks7.json",
14
+ "multiple-webhooks8.json",
15
+ "multiple-webhooks9.json",
16
+ "multiple-webhooks10.json"
17
+ ]
18
+ },
19
+ "scriptPath": "multiple-webhooks.script.js"
20
+ }
@@ -0,0 +1,19 @@
1
+ import http from 'k6/http';
2
+ import { check } from 'k6';
3
+
4
+ const apiBaseUrl = __ENV.API_BASE_URL;
5
+
6
+ export default function () {
7
+ const urls = Array(10)
8
+ .fill()
9
+ .map((_, i) => `${apiBaseUrl}/webhook/multiple-webhook${i + 1}`);
10
+
11
+ const res = http.batch(urls);
12
+
13
+ for (let i = 0; i < res.length; i++) {
14
+ // Check if the response status is 200
15
+ check(res[i], {
16
+ 'is status 200': (r) => r.status === 200,
17
+ });
18
+ }
19
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 1",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook1", "options": {} },
9
+ "id": "b239bc6c-ea40-438d-bb14-5bce03599685",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "14226baf-ea56-43d7-bc0d-eea841746441"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "0322386c-ec84-4d38-b895-c206b574f31c",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 10",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook10", "options": {} },
9
+ "id": "34ac4500-9a29-4f4f-a604-134aa2cb2889",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "47fe25ac-1376-4ee7-b9de-3fff1d49281c"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "106d4d2c-49c0-45b8-8421-99cc0c8b1589",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 2",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook2", "options": {} },
9
+ "id": "c44ce610-086c-45a6-b347-c7b5df5365ed",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "edc1994b-7cde-4aed-b077-fbc7f21b0f48"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "b4579dbf-d9c5-4b57-8e1f-883d91e8726b",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 3",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook3", "options": {} },
9
+ "id": "34ac4500-9a29-4f4f-a604-134aa2cb2889",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "47fe25ac-1376-4ee7-b9de-3fff1d49281c"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "106d4d2c-49c0-45b8-8421-99cc0c8b1589",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 4",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook4", "options": {} },
9
+ "id": "34ac4500-9a29-4f4f-a604-134aa2cb2889",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "47fe25ac-1376-4ee7-b9de-3fff1d49281c"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "106d4d2c-49c0-45b8-8421-99cc0c8b1589",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 5",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook5", "options": {} },
9
+ "id": "34ac4500-9a29-4f4f-a604-134aa2cb2889",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "47fe25ac-1376-4ee7-b9de-3fff1d49281c"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "106d4d2c-49c0-45b8-8421-99cc0c8b1589",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 6",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook6", "options": {} },
9
+ "id": "34ac4500-9a29-4f4f-a604-134aa2cb2889",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "47fe25ac-1376-4ee7-b9de-3fff1d49281c"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "106d4d2c-49c0-45b8-8421-99cc0c8b1589",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 7",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook7", "options": {} },
9
+ "id": "34ac4500-9a29-4f4f-a604-134aa2cb2889",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "47fe25ac-1376-4ee7-b9de-3fff1d49281c"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "106d4d2c-49c0-45b8-8421-99cc0c8b1589",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "createdAt": "2024-08-06T12:19:51.268Z",
3
+ "updatedAt": "2024-08-06T12:20:45.000Z",
4
+ "name": "Multiple Webhook 8",
5
+ "active": true,
6
+ "nodes": [
7
+ {
8
+ "parameters": { "path": "multiple-webhook8", "options": {} },
9
+ "id": "34ac4500-9a29-4f4f-a604-134aa2cb2889",
10
+ "name": "Webhook",
11
+ "type": "n8n-nodes-base.webhook",
12
+ "typeVersion": 2,
13
+ "position": [760, 400],
14
+ "webhookId": "47fe25ac-1376-4ee7-b9de-3fff1d49281c"
15
+ }
16
+ ],
17
+ "connections": {},
18
+ "settings": { "executionOrder": "v1" },
19
+ "staticData": null,
20
+ "meta": { "templateCredsSetupCompleted": true, "responseMode": "lastNode", "options": {} },
21
+ "pinData": {},
22
+ "versionId": "106d4d2c-49c0-45b8-8421-99cc0c8b1589",
23
+ "triggerCount": 1,
24
+ "tags": []
25
+ }