JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q20251F
  • License MIT

wrk benchmarking http node.js

Package Exports

  • wrk-node

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wrk-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

wrk-node-benchmarking

Wrk node.js http benchmarking tool. A framework wrapper for wrk benchmarking. Instead if globally running it. This will be implemented in gulp task runners.

Run

./node_modules/.bin/wrk <options> <url>

Usage

'use strict';
var wrkNode = require( 'wrk-node' );
var config = {
  // This required
    'server' : {
        'host' : process.env.TEST_HOST || 'http://localhost',
        'port' : process.env.TEST_PORT || 4000
    },

    // This are custom headers
    'headers' : {
        'contentType'   : 'application/json; charset=utf-8',
        'engineId'      : process.env.TEST_ENGINE_ID || 'xxxxxxxxxxxxxxxxxxxx',
        'engineSecret'  : process.env.TEST_ENGINE_SECRET || 'xxxxxxxxxxxxxxxxx',
    },

    // Target folder contains folders to be benchmarked
    'targetFolder' : '/benchmark/**/*.js',

    'getAuth' : function ( done ) {
      // add session token then call done();
    }
};

wrkNode( config ).exec( function () {
  console.log( 'Done benchmarking' );
} );

Benchmark .js file configurations

'use strict';

module.exports = {

    'request' : {
        'path'   : '/api/v1/legacy/states',
        'method' : 'GET'
    },

    'customHeaders' : {},

    'options' : {
        'duration' : '10s',
        'threads' : 3,
        'connections' : 10
    },

    'threshold' : {
        'reqRate' : {
            'min' : 20
        }
    }

};

Update version

Currently this repo uses 4.0.0. This command updates your own version of wrk.

make install VERSION=<wrk-version>

Clean up

make clean