npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

kaskade-benchmarking

v1.1.1

Published

Kaskade -- a benchmarking tool.

Downloads

4

Readme

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