Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support running Artillery in serverless environment #22

Open
bchrobot opened this issue Jun 15, 2023 · 1 comment
Open

Support running Artillery in serverless environment #22

bchrobot opened this issue Jun 15, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@bchrobot
Copy link
Member

Add documentation and support for running on AWS Lambda.

Serverless execution now has first-class support in Artillery and is a more accurate load test than running from a local development machine.

https://www.artillery.io/docs/load-testing-at-scale/aws-lambda

@bchrobot bchrobot added the enhancement New feature or request label Jun 15, 2023
@bchrobot
Copy link
Member Author

Encountering issues running on lamba

First was a bundle size issue. Unzipped function > 250 MB.

This was addressed by forcing resolution of dependencies to later versions (includes attempted fix for two live issues):

diff --git a/package.json b/package.json
index c005b79..bdd1a62 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,8 @@
     "artillery": "artillery"
   },
   "dependencies": {
-    "artillery": "^2.0.0-33",
+    "@artilleryio/platform-fargate": "^1.0.7",
+    "artillery": "^2.0.0-34",
     "artillery-plugin-metrics-by-endpoint": "^1.2.0",
     "csv-parse": "^5.4.0",
     "csv-stringify": "^6.4.0",
@@ -21,7 +22,13 @@
     "lodash": "^4.17.21",
     "papaparse": "^5.4.1",
     "pg": "^8.11.0",
+    "protobufjs": "^7.2.4",
     "puppeteer": "^20.7.1",
     "superagent": "^8.0.9"
+  },
+  "resolutions": {
+    "@artilleryio/platform-fargate": "^1.0.7",
+    "@aws-sdk/credential-providers": "^3.370.0",
+    "@artilleryio/sketches-js": "2.1.0"
   }
 }

Error: Cannot find module 'protobufjs/minimal'

  stdout: 'Test run id: tnyqj_jf7mp6ekp8atmb8m5ecp5txngjtnm_md4w\n' +
    'Phase started: Spike - Spoke Autosending @ 100 (index: 0, duration: 60s) 13:11:18(+0000)\n' +
    '\n' +
    "worker error, id: 1 Error: Cannot find module 'protobufjs/minimal'\n" +
    'Require stack:\n' +
    '- /var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/ddsketch/proto/compiled.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/ddsketch/DDSketch.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/ddsketch/index.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/index.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@artilleryio/int-core/lib/ssms.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@artilleryio/int-core/index.js\n' +
    '- /var/task/node_modules/artillery/lib/artillery-global.js\n' +
    '- /var/task/node_modules/artillery/lib/platform/local/worker.js\n' +
    '    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)\n' +
    '    at Function.Module._load (node:internal/modules/cjs/loader:871:27)\n' +
    '    at Module.require (node:internal/modules/cjs/loader:1098:19)\n' +
    '    at require (node:internal/modules/cjs/helpers:108:18)\n' +
    '    at Object.<anonymous> (/var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/ddsketch/proto/compiled.js:3:17)\n' +
    '    at Module._compile (node:internal/modules/cjs/loader:1196:14)\n' +
    '    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)\n' +
    '    at Module.load (node:internal/modules/cjs/loader:1074:32)\n' +
    '    at Function.Module._load (node:internal/modules/cjs/loader:909:12)\n' +
    '    at Module.require (node:internal/modules/cjs/loader:1098:19) {\n' +
    "  code: 'MODULE_NOT_FOUND',\n" +
    '  requireStack: [\n' +
    "    '/var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/ddsketch/proto/compiled.js',\n" +
    "    '/var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/ddsketch/DDSketch.js',\n" +
    "    '/var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/ddsketch/index.js',\n" +
    "    '/var/task/node_modules/artillery/node_modules/@artilleryio/sketches-js/dist/index.js',\n" +
    "    '/var/task/node_modules/artillery/node_modules/@artilleryio/int-core/lib/ssms.js',\n" +
    "    '/var/task/node_modules/artillery/node_modules/@artilleryio/int-core/index.js',\n" +
    "    '/var/task/node_modules/artillery/lib/artillery-global.js',\n" +
    "    '/var/task/node_modules/artillery/lib/platform/local/worker.js'\n" +
    '  ]\n' +
    '}\n',

Error Plugin: artillery: Cannot find module '@artilleryio/platform-fargate'

  stderr: "(node:24) [MODULE_NOT_FOUND] Error Plugin: artillery: Cannot find module '@artilleryio/platform-fargate'\n" +
    'Require stack:\n' +
    '- /var/task/node_modules/artillery/lib/cmds/run-fargate.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@oclif/config/lib/plugin.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@oclif/config/lib/config.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@oclif/config/lib/index.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@oclif/command/lib/command.js\n' +
    '- /var/task/node_modules/artillery/node_modules/@oclif/command/lib/index.js\n' +
    '- /var/task/node_modules/artillery/bin/run\n' +
    'module: @oclif/[email protected]\n' +
    'task: toCached\n' +
    'plugin: artillery\n' +
    'root: /var/task/node_modules/artillery\n' +
    'See more details with DEBUG=*\n' +
    '(Use `node --trace-warnings ...` to show where the warning was created)\n'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant