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

superbench

v0.0.2

Published

"A lightweight load testing framework for Node.js"

Downloads

44,475

Readme

superbench

superbench is a lightweight load testing framework for Node.js. superbench focuses on a distributed execution and an aggregation. A test scenario is written in JavaScript code. superbench doesn't depend on any API clients. So, you can test any servers with the clients.

Installing

npm install -g superbench

Usage

Create your test scenario file

import defineBenchmark from "superbench";

defineBenchmark({
    title: "someAPI",
    description: "check some API",
    concurrentRequestNum: 10,
    measurementInterval: 30,  // sec
    duration: 180 // sec
}, async benchmark => {
    // You need write a scenario code for parallelization that is run in a worker.
    const tasks = [];
    // superbench calculates request num of this worker.
    // You can get it from `benchmark.requestNum`.
    for (let i = 0; i < benchmark.requestNum; i++) {
        tasks.push(new Promise(async resolve => {
            // If you run loop processing, you need to check `benchmark.running`.
            while (benchmark.running) {
                const t1 = benchmark.test("healthcheck1");
                try {
                    await yourAPIClient.callSomeAPI();
                    t1.success();
                } catch (e) {
                    t1.error(e);
                }
            }
            resolve();
        }));
    }
    await Promise.all(tasks);
});

Standalone

superbench start path/to/benchmarkDefineFile.js

Master/Slave

superbench supports master/slave clustering mode. It helps you to distribute the load of client efficiently

  1. Run slave in slave host
superbench slave path/to/benchmarkDefineFile.js
  1. Run master in master host
superbench start path/to/benchmarkDefineFile.js -s slave-host:8080

Reporting

Standard output

==================================================================================
title: someAPI
description: check some API
benchmark define file: path/to/benchmarkDefineFile.js
duration(sec): 180
measurement interval(sec): 30
==================================================================================
                                    [ Progress ]
elapsed   req       rps       avg       min       max       median    error(%)
30s       1890      62.99     153.44ms  150ms     157ms     154ms     96(5.08)
60s       1972      65.71     152.96ms  149ms     158ms     153ms     110(5.58)
90s       1968      65.59     152.88ms  149ms     157ms     153ms     101(5.13)
120s      1970      65.64     153.17ms  149ms     160ms     153.5ms   92(4.67)
150s      1965      65.48     153.43ms  149ms     159ms     154ms     108(5.5)
180s      1965      65.48     153.4ms   149ms     156ms     154ms     95(4.83)
==================================================================================
                                  [ Group Result ]
group               req       avg       min       max       median    error(%)
healthcheck1        11730     153.21ms  149ms     160ms     154ms     602(5.13)
==================================================================================
                                     [ Errors ]
602 errors are found.
...
==================================================================================
                                  [ Global Result ]
started             Wed Feb 14 2018 03:29:36 GMT+0900 (JST)
finished            Wed Feb 14 2018 03:32:36 GMT+0900 (JST)
worker              4
duration            180077ms
requests            11730
rps                 65.14
avg                 153.21ms
min                 149ms
max                 160ms
median              154ms
success(%)          11128(94.87)
error(%)            602(5.13)

File output

It will be added in the near future version.

Report Plugin

It will be added in the near future version.

Building

git clone https://github.com/superbench/superbench.git
cd superbench
npm install
npm run build

Contribution

  1. Fork it ( http://github.com/superbench/superbench )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

LICENSE

MIT