0.1.8 • Published 11 months ago

@dwp/casa-spiderplan-k6-plugin v0.1.8

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

Performance plugin for casa-spiderplan

Add performance testing to your Spiderplan Personas.

Features:

  • Generates a k6 script for each of your personas

Pre-requisites

  • NodeJS 16.17.0+

Getting started

Install the plugin:

npm i -DE @dwp/casa-spiderplan-k6-plugin

Configure your worker bootstrap script to enable this plugin:

const perf = require('@dwp/casa-spiderplan-k6-plugin');

module.exports = ({ sharedState }) => {
  // Other setup stuff ..

  // Load hooks
  const hooks = [
    ...await perf({
      // Output directory to store k6 scripts
      dir: '.k6/',

      // Shared memory (required)
      sharedState,
    }),
  ];

  // Along with the other worker-init attribute, return the "hooks" attribute
  // containing the list of hooks that will be used
  return {
    hooks,
  };
};

Run your Spiderplan tests as normal. Be mindful that the host environment against which your personas are run muct be similarly running when you run finally execute the k6 scripts later. For example, if your app depends on any running external services, then those same services will need to be running when executing the k6 scripts.

Scripts are written to the output directory (default .k6/).

Executing k6 scripts

Once the scripts have been generated, you are free to pass them through k6 however you see fit. Here's an example, use docker:

# Start your target service locally - starts on http://localhost:3000/, for example
npm start

# Execute one of the generated k6 scripts against that target
docker run -i --rm --name k6 \
  -e hostname=http://host.docker.internal:3000 \
  loadimpact/k6 run - <$PWD/.k6/your-persona.js

Process overview

The following Spiderplan hooks are used:

  • post-submit-form Logs an entry for the final k6 script that GETs and POSTs to the appropriate waypoint
  • post-process-persona Generates the k6 script for the persona and stores in the output directory (default .k6/)

Performance

On an MDM mac (16GB RAM, 2.2GHz 6core CPU), with all content variants enabled:

  • 303 Personas
  • 6 worker threads
  • Execution time: 4m5s

References

0.1.8

11 months ago

0.1.7

12 months ago

0.1.6

1 year ago

0.1.4

1 year ago

0.1.5

1 year ago

0.1.2

2 years ago