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

httperfjs

v0.1.0

Published

Node.js binding for HTTPerf

Downloads

7

Readme

HTTPerf.js

Build Status   Dependancy Status   NPM Version

Simple Node.js interface for httperf. This is a node port of HTTPerf.rb and works pretty much the same way.

What hasn't been ported or is different from the ruby version:

  • parse is true by default.
  • tee isn't currently supported.
  • httperf must be in your PATH

Links

Node.js Version

Tested on the following node versions (via Travis-ci.org:

  • 0.10
  • 0.11

Installation

$ npm install httperfjs

Basic usage:

:::js
var HTTPerf = require('httperfjs');

var httperf = new HTTPerf({
    "server": "mervine.net",
    "verbose": true,
    "hog": true,
    "uri": "/about",
    "num-conns": 100}
);

httperf.run(function (result) {
    console.log(result);
    console.log(result.connection_time_avg);
});
// => { object with httperf values }
// => '123.4'

httperf.parse = false;
var child = httperf.run(function (result) {
    console.log(result);
});
// => "string with httperf stdout"

// httperf dumps data on SIGINT (crtl-c), HTTPerf's run
// supports this as well, with the following addition
// to your scripts
process.on('SIGINT', function() {
    child.send('SIGINT');
});

NodeUnit Benchmark Example

:::js
// file: ./test/benchmark.js
var HTTPerf = require('httperfjs');
var httperf = new HTTPerf({
    server:      "mervine.net",
    uri:         "/",
    "num-conns": 9
});

var run;

module.exports = {
    tearDown: function (callback) {
        run = undefined;
        callback();
    },

    'homepage should be quick': function (test) {
        test.expect(1);
        httperf.run( function (run) {
            test.ok(run.connection_time_median < 200,
                "homepage was too slow: got " + run.connection_time_median
                   + " but expected: < 200");
            test.done();
        });
    },

    'archive should be quick': function (test) {
        test.expect(1);
        httperf.run( function (run) {
            test.ok(run.connection_time_median < 200,
                "archive was too slow: got " + run.connection_time_avg
                    + " but expected: < 200");
            test.done();
        });
    }
};
// $ ./node_modules/.bin/nodeunit ./test/benchmark.js

Parser Keys:

command
max_connect_burst_length
total_connections
total_requests
total_replies
total_test_duration
connection_rate_per_sec
connection_rate_ms_conn
connection_time_min
connection_time_avg
connection_time_max
connection_time_median
connection_time_stddev
connection_time_connect
connection_length
request_rate_per_sec
request_rate_ms_request
request_size
reply_rate_min
reply_rate_avg
reply_rate_max
reply_rate_stddev
reply_rate_samples
reply_time_response
reply_time_transfer
reply_size_header
reply_size_content
reply_size_footer
reply_size_total
reply_status_1xx
reply_status_2xx
reply_status_3xx
reply_status_4xx
reply_status_5xx
cpu_time_user_sec
cpu_time_system_sec
cpu_time_user_pct
cpu_time_system_pct
cpu_time_total_pct
net_io_kb_sec
net_io_bps
errors_total
errors_client_timeout
errors_socket_timeout
errors_conn_refused
errors_conn_reset
errors_fd_unavail
errors_addr_unavail
errors_ftab_full
errors_other

Verbose Percentile Parser Keys:

These require a non-standard version of httperf. See: httperf-0.9.1 with individual connection times.

connection_time_75_pct
connection_time_80_pct
connection_time_85_pct
connection_time_90_pct
connection_time_95_pct
connection_time_99_pct

Accepted Options:

"add-header"
"burst-length"
"client"
"close-with-reset"
"debug"
"failure-status"
"hog"
"http-version"
"max-connections"
"max-piped-calls"
"method"
"no-host-hdr"
"num-calls"
"num-conns"
"period"
"port"
"print-reply"
"print-request"
"rate"
"recv-buffer"
"retry-on-failure"
"send-buffer"
"server"
"server-name"
"session-cookies"
"ssl"
"ssl-ciphers"
"ssl-no-reuse"
"think-timeout"
"timeout"
"uri"
"verbose"
"version"
"wlog"
"wsess"
"wsesslog"
"wset"