Socket
Socket
Sign inDemoInstall

kaskade-benchmarking

Package Overview
Dependencies
18
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    kaskade-benchmarking

Kaskade -- a benchmarking tool.


Version published
Weekly downloads
5
Maintainers
1
Install size
1.76 MB
Created
Weekly downloads
 

Readme

Source

Kaskade - Sequential, Concurrent Server Testing · npm version

Overview

Kaskade is a server benchmarking tool that runs sequences of stateful, concurrent requests to a deployed or local server. Kaskade utilizes worker threads within Node.js to handle multithreading and create simulated concurrent server requests.

Simply install the npm module, create a config file using the format outlined in the Getting Started section, and import the kaskade-benchmarking module. Once your config file is set up, run the node command on your specified file and watch it go! Metrics tables of latency, byte throughput and requests/second are populated right in the command line.

Tech Stack

My Skills

Installation

Install the NPM module here, or by running npm i kaskade-benchmarking in the command line.

Getting Started

To test your server with Kaskade, a configuration file must be setup. Within the project's root directory, create a .json file and define the parameters according to the criteria within the config object below:

// The following is an example benchmark config object that Kaskade will accept
// It comes with detailed comments to explain each field and if the field is required.
// For an actual JSON file, see the Example section within the Read.me

const config = {
    // "servers" should contain a list of HTTP servers under test.
    //  REQUIRED, Must contain at least 1 server
    servers: [
        "localhost:3000",
    ],

    // REQUIRED, "testDuration" is the duration of running benchmark test, in seconds.
    testDuration: 600,
   
    // REQUIRED, the number of concurrent users to access HTTP servers
     concurrentUsers: 100,
    
    // OPTIONAL, the target number of HTTP requests to send to servers per second
    // if not set, the HTTP requests rate will be unlimited
    targetThroughput: 1000,

    // REQUIRED, a list of different types of sessions to run in this benchmark
    sessions: [{
        // a human readable name of this session
        sessionName: "login and add to cart session",

        // an ordered list of all the HTTP requests to issue in this session. REQUIRED: requestName, url, method, headers. OPTIONAL: body (dependent on request method)
        requests: [
            {
                // a human readable name of this request
                requestName: "load home page",
                // the request url
                url: "/",
                // the HTTP request method
                method: "GET",
                // an object that contains all HTTP headers to send
                headers: { 'Content-type': 'application/json' },
            },
            {
                requestName: "login",
                url: "/api/login",
                method: "POST",
                headers: { 'Content-type': 'application/json' },
                // The HTTP request body, can be either a string or an object
                // if it is an object, Kaskade will JSON.stringify before send the request
                body: {
                    username: 'test1',
                    password: 'test1'
                }
            },
            {
                requestName: "add to card",
                url: "/api/cart/addtocart",
                method: 'POST',
                headers: {
                    'Content-type': 'application/json'
                },
                body: {
                    listingId: 123,
                    qty: 2
                },
            },
        ]
    }]
}

Example

Below is a sample configuration file:

{
    "servers": [
        "localhost:3000"
    ],
    "testDuration": 600,
    "targetThroughput": 1000,
    "numOfWorkers":4,
    "sessions": [
        {
            "sessionName": "login and add to cart session",
            "requests": [
                {
                    "requestName": "load home page",
                    "url": "/",
                    "method": "GET",
                    "headers": {
                        "Content-type": "application/json"
                    }
                },
                {
                    "requestName": "add to card",
                    "url": "/api/cart/addtocart",
                    "method": "POST",
                    "headers": {
                        "Content-type": "application/json"
                    },
                    "body": {
                        "listingId": 123,
                        "qty": 2
                    }
                }
            ]
        }
    ]
}

Contributing

[request a feature or report a bug]

Kaskade's goal is to expand our functionality, but we can't do it without you! One of the great benefits of open source projects, like Kaskade, is the ability for the community to actively contribute. Feel free to fork this project, make changes or fix bugs, and submit a pull request to the dev branch. Please limit scope of commits to address one feature or bug at a time.

To expediate the integration process, please copy the below PR example template and modify to reflect any changes to be considered for merging into the codebase.

# Summary

This pull request introduces adds units to the results table and pulls the session/request name into the latency table stat column.

## Related Issue

Missing units in table and lack of clarity.

## Type of Change

- [ ] Bug fix
- [x] New feature
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

## Testing Steps

1. Run console.log of printResults, which is commented out on bottom of printResults.js

## Checklist

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas

Publications

Head over to Kaskade's splash page and LinkedIn for more details!

Checkout and clap our Medium article here for more details behind Kaskade!

Our Team

License

Kaskade is MIT Licensed

Keywords

FAQs

Last updated on 16 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc