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 🙏

© 2026 – Pkg Stats / Ryan Hefner

load-gen

v0.0.7

Published

[![CI](https://github.com/mohoff/load-generator/actions/workflows/ci.yml/badge.svg)](https://github.com/mohoff/load-generator/actions/workflows/ci.yml)

Readme

load-generator

CI

A simple but powerful JS load generator. Generates load based on input data, an action that simulates IO, and various configurations that determine the load characteristics. Load can be randomized but still reproducible.

Example

A simple load generator can be constructed and run like this:

const { LoadGenerator, PICKING, FREQUENCY, VISIT_DATA } = require('...');

await LoadGenerator.from([1, 2, 3])
    .action((n) => n * 2)
    .config({
        pick: PICKING.SEQUENTIAL,
        frequency: FREQUENCY.RANDOM,
        visit: VISIT_DATA.ONCE,
        meanActionsPerSecond: 1,
    })
    .run();

This prints:

data: a615eeaee21de5179de080de8c3052c8da901138406ba71c38c032845f7d54f4
config: 687dfee9fb5ed0aa0fd1c92a4c84a012e18a7664b144799f6c3d12696ab164ad
generating load...
delay by 213.0170022137463ms
[i=0] running fn with data[0] 1
delay by 919.4761351682246ms
[i=1] running fn with data[1] 2
delay by 898.0880929157138ms
[i=2] running fn with data[2] 3
done generating data.

You can run this generator with yarn example [--quiet] or npm run example -- [--quiet].

How-To

from/fromGen are static build methods that take an array or a generator to initialize the load generator with data. If no data should be used, e.g. in case the action does not have inputs, an empty array can be passed.

action takes an (async) function that is applied to each data element and performs the IO.

config is an object with generator configuration. These settings determine how and when load is generated, as well as under what circumstances the load generator should terminate. Through a combination of settings, complex load generators can be realized.

Configuration

  • PICK: When pick is set to SEQUENTIAL, the data array is traversed sequentially. When set to RANDOM, the data array is randomly traversed. If a generator function is used instead of a data array, pick does not matter as the function dictates picking order.

  • FREQUENCY: When frequency is set to STATIC, load is generated in static time intervals. When set to RANDOM, random time intervals are used. For both options, the setting meanActionsPerSecond determines the mean frequency of generated load.

  • VISIT_DATA: When visit is set to ONCE, each data element is used at most once. In other words, the data is exhausted. When set to REPEAT, each data element can be used multiple times. Independent of the pick setting, each data element is exactly used once before the data can be visited again for load generation.

Other config options:

  • seed: A seed string used to initialize the PRNG, which determines the randomness in PICK.RANDOM and FREQUENCY.RANDOM.
  • meanActionsPerSecond: Effective throughput of the load generator. Applies to FREQUENCY.STATIC as well as FREQUENCY.RANDOM.
  • maxGenerations: The maximum number of load generations. Default: Infinity
  • runFor: The maximum time duration load should be generated in. Default: Infinity

Development

Tag a new version:

npm version [major|minor|patch] -m "chore: release %s"

CI will take care of releasing