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

gatling

v2.0.0

Published

A simple node.js script that turns a single-threaded server into a multi-threaded server with automatic restarting.

Downloads

578

Readme

Gatling

A simple node.js script that turns a simple single-process server into a multi-process cluster'd server with automatic restarting.

Plays nice with Express and similar libraries.

Build Status

Installation

npm install --save gatlin

Recommended Setup

Instead of calling node server.js call npx gatling server.js. It will start one manager process + one worker process for each logical CPU core.

package.json

Add a scripts.start entry like so:

{
  //...
  "scripts": {
    "start": "gatling app.js"
  }
}

Legacy Setup

This was the only option in v1, and is preserved for backwards-compatibility.

Instead of starting the server, simply export the handler function and then call gatlin with the path to your server.js or app.js.

(The reason this was needed is that Gatlin ran each request inside a domain in v1. It prevented errors in one request from interfering with any other requests, but the API has since been deprecated.)

Express

Just change

app.listen(port)

to

module.exports = app;

HTTP

Your app should export the function that gets passed to http.createServer and not create the server itself.

For example, say your app.js looks like this:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337);

Change it to this:

module.exports = function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
});

Usage

To start your server, run npm start. Or, to call gatling directly, run ./node_modules/bin/gatling app.js

API

The following command line options are accepted

-q, --quiet: silences all non-error output --processes 2: Set the number of worker processes. Defaults to one per CPU core. -p 1234, --port 1234: defaults to the PORT or VCAP_APP_PORT (bluemix) environment properties, or 8080 if not set. (Only applies when gatling starts the server rathern than your app.)

Changelog

v2.0.0

  • Removed Domain support
  • Removed newrellic support
  • Added support for regular app.js / server.js files that start call listen() themselves
  • Bumped minimum Node.js version to 6.0.0