{"_id":"nodeload","_rev":"23-a747348af105c01013ba83e45f6a2c29","name":"nodeload","description":"Load testing library for node.js","dist-tags":{"latest":"0.4.0"},"versions":{"0.2.0":{"name":"nodeload","version":"0.2.0","description":"Load testing library for node.js","url":"https://github.com/benschmaus/nodeload","engines":{"node":">=0.3.0"},"contributors":[{"name":"Benjamin Schmaus","email":"benjamin.schmaus@gmail.com"},{"name":"Jonathan Lee","email":"jonjlee@gmail.com"},{"name":"Robert Newson","email":"robert.newson@gmail.com"},{"name":"Michael Mattozzi","email":"mike.mattozzi@gmail.com"}],"repository":{"type":"git","url":"http://github.com/benschmaus/nodeload"},"main":"./nodeload","bin":{"nodeload.js":"./nodeload.js","nl.js":"./nl.js"},"modules":{"config":"./lib/config","loop":"./lib/loop","stats":"./lib/stats","monitoring":"./lib/monitoring","http":"./lib/http","reporting":"./lib/reporting","remote":"./lib/remote"},"scripts":{"test":"expresso","preinstall":"make clean compile"},"devDependencies":{"expresso":">=0.7.0"},"dependencies":{},"_id":"nodeload@0.2.0","_nodeSupported":true,"_npmVersion":"0.2.10-1","_nodeVersion":"v0.3.2-pre","dist":{"shasum":"2bf2d5f0d291663ecd5271a73c75e507bc5c8494","tarball":"https://registry.npmjs.org/nodeload/-/nodeload-0.2.0.tgz","bin":{"0.4-sunos-5.11":{"shasum":"7eedb6b91c9db458c248c6c2fc03c5045d408f97","tarball":"http://registry.npmjs.org/nodeload/-/nodeload-0.2.0-0.4-sunos-5.11.tgz"}},"integrity":"sha512-2dN4LSX6m5vBEf1a7PxmCblI8cnj30dV6HvmY704XP/6SGhjcFG/ykxiam79hBili5X57q/HVYkcVAqK92KvZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCpwRMJiRYCQTMwWw/SLcp0wam3bJhh0RkCIe2b4SGPXgIhAJfzmrX9/qDzYhjdXPPyP9hx0gFTDLyR4mRKHJvL/ROJ"}]},"directories":{}},"0.4.0":{"name":"nodeload","version":"0.4.0","description":"Load testing library for node.js","keywords":["testing","load testing","http"],"homepage":"https://github.com/benschmaus/nodeload","engines":{"node":">=0.4"},"contributors":[{"name":"Benjamin Schmaus","email":"benjamin.schmaus@gmail.com"},{"name":"Jonathan Lee","email":"jonjlee@gmail.com"},{"name":"Robert Newson","email":"robert.newson@gmail.com"},{"name":"Michael Mattozzi","email":"mike.mattozzi@gmail.com"}],"bugs":{"url":"https://github.com/benschmaus/nodeload/issues"},"repository":{"type":"git","url":"git://github.com/benschmaus/nodeload.git"},"main":"./nodeload.js","bin":{"nodeload.js":"./nodeload.js","nl.js":"./nl.js"},"directories":{"doc":"./doc","lib":"./lib","example":"./examples"},"scripts":{"test":"expresso","preinstall":"make clean compile"},"devDependencies":{"expresso":">=0.7.7"},"dependencies":{"optparse":"1.0.3"},"licenses":[{"type":"MIT","url":"https://github.com/benschmaus/nodeload/raw/master/LICENSE"}],"_npmUser":{"name":"bschmaus","email":"benjamin.schmaus@gmail.com"},"_id":"nodeload@0.4.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.0-2","_nodeVersion":"v0.7.2-pre","_defaultsLoaded":true,"dist":{"shasum":"79fa406f7166229459bebd7db621940416b676ec","tarball":"https://registry.npmjs.org/nodeload/-/nodeload-0.4.0.tgz","integrity":"sha512-InDJU/Wd+oedk6tcqDmPXwvWnMaRY9v7Onu8FVwoNF0jyJeia1+Z1VNGe4dTJTWwH55GbfUog3IavrINpntYcQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0M/DDMwKx4vMwKLn8G2+5eLHXvJkPAcbwsTq9PUw3DwIgFE5oIia2BoEKfTDHKAfaHQlfs6/5eugs8qIwfqI0IBM="}]},"maintainers":[{"name":"jonjlee","email":"jonjlee@gmail.com"},{"name":"bschmaus","email":"benjamin.schmaus@gmail.com"}]}},"maintainers":[{"name":"jonjlee","email":"jonjlee@gmail.com"},{"name":"bschmaus","email":"benjamin.schmaus@gmail.com"}],"repository":{"type":"git","url":"git://github.com/benschmaus/nodeload.git"},"time":{"modified":"2022-06-22T02:59:29.386Z","created":"2011-03-31T06:12:15.907Z","0.2.0":"2011-03-31T06:12:15.907Z","0.4.0":"2012-02-04T03:22:29.498Z"},"readme":"INSTALLING\n================\n\nMake sure [node.js](http://nodejs.org/#download) is installed. Then install `nodeload`:\n\n1. Using [npm](http://npmjs.org/):\n\n        curl http://npmjs.org/install.sh | sh       # install npm if not already installed\n        npm install nodeload\n\n2. From source:\n\n        git clone git://github.com/benschmaus/nodeload.git\n        cd nodeload\n        npm link    # optional. enables require('nodeload/<module>') instead of require('./lib/<module>').\n\n3. Or as a single file (this does not install the `nl.js` tool):\n\n        wget https://github.com/benschmaus/nodeload/raw/master/nodeload.js\n\nNODELOAD\n================\n\n`nodeload` is a collection of independent [node.js](http://nodejs.org/) modules for load testing HTTP services.\n\nAs a developer, you should be able to write load tests and get informative reports without having to learn another framework. You should be able to build by example and selectively use the parts of a tool that fit your task. Being a library means that you can use as much or as little of `nodeload` as makes sense, and you can create load tests with the power of a full programming language. For example, if you need to execute some function at a given rate, just use the [`'nodeload/loop'`](https://github.com/benschmaus/nodeload/tree/master/doc/loop.md) module, and write the rest yourself.\n\nIn addition, `nodeload` is built for operability. It can always be deployed by simply copying the single file, `nodeload.js`.\n\nLook for examples in the [`examples/`](https://github.com/benschmaus/nodeload/tree/master/examples) directory and in test cases prefixed with \"example\" in [`test/`](https://github.com/benschmaus/nodeload/tree/master/test). Here are simple examples of each module:\n\n### [nl](https://github.com/benschmaus/nodeload/tree/master/doc/nl.md)\n\n`nl` is an [Apache Bench (ab)](http://httpd.apache.org/docs/2.0/programs/ab.html) like command line tool for running tests quickly. See the [nl documentation](https://github.com/benschmaus/nodeload/tree/master/doc/nl.md) for details.\n\n    $ examples/test-server.js &    # starts a simple server on port 9000 to load test\n    $ ./nl.js -c 10 -n 10000 -i 2 localhost:9000\n\nwill send 10,000 queries to http://localhost:9000 using 10 connections. Statistics are printed to the console and graphs can be seen at <http://localhost:8000/>.\n\n### [nodeload](https://github.com/benschmaus/nodeload/tree/master/doc/nodeload.md)\n\nThe `nodeload` module is the primary interface for creating load tests. It includes all the other modules described below, so if you `require('nodeload')`, you don't need to `require()` any of the other ones. Look at the examples in [`examples/loadtesting.ex.js`](https://github.com/benschmaus/nodeload/tree/master/examples/loadtesting.ex.js) and [`examples/riaktest.ex.js`](https://github.com/benschmaus/nodeload/tree/master/examples/riaktest.ex.js) or read the [nodeload module documentation](https://github.com/benschmaus/nodeload/tree/master/doc/nodeload.md).\n\n    var nl = require('nodeload');\n    var loadtest = nl.run({\n        host: 'localhost',\n        port: 9000,\n        timeLimit: 60,\n        targetRps: 500,\n        requestGenerator: function(client) {\n            var request = client.request('GET', \"/\" + Math.floor(Math.random()*10000));\n            request.end();\n            return request;\n        }\n    });\n    loadtest.on('end', function() { console.log('Load test done.'); });\n\n### [remote](https://github.com/benschmaus/nodeload/tree/master/doc/remote.md)\n\nThe `remote` module provides a mechanism for running a distributed load test. See [`examples/remotetesting.ex.js`](https://github.com/benschmaus/nodeload/tree/master/examples/remotetesting.ex.js) and [`examples/remote.ex.js`](https://github.com/benschmaus/nodeload/tree/master/examples/remote.ex.js) for examples or read the [remote module documentation](https://github.com/benschmaus/nodeload/tree/master/doc/remote.md).\n\nStart slave instances:\n\n    $ HTTP_PORT=10001 ./nodeload.js  # start a local slave instance on :10001\n    $ HTTP_PORT=10002 ./nodeload.js  # start a 2nd slave instance on :10002\n    \nCreate the distributed load test:\n\n    var nl = require('nodeload/remote');\n    var cluster = new nl.LoadTestCluster('localhost:8000', ['localhost:8002', 'localhost:8001']);\n    cluster.run({\n        host: 'localhost',\n        port: 9000,\n        timeLimit: 60,\n        targetRps: 500,\n        requestGenerator: function(client) {\n            var request = client.request('GET', \"/\" + Math.floor(Math.random()*10000));\n            request.end();\n            return request;\n        }\n    });\n    cluster.on('end', function() { console.log('Load test done.'); });\n\n### [stats](https://github.com/benschmaus/nodeload/tree/master/doc/stats.md)\n\nThe `stats` module provides implementations of various statistics objects, like Histograms and Accumulators, and functions, like randomString(), and nextGaussian(). See the [stats module documentation](https://github.com/benschmaus/nodeload/tree/master/doc/stats.md).\n\n    var stats = require('nodeload/stats');\n    var histogram = new stats.Histogram();\n    for (var i = 0; i < 1000; i++) \n        histogram.put(Math.abs(Math.floor(stats.nextGaussian())));\n    console.log('Mean: ' + histogram.mean() + ', 99%: ' + histogram.percentile(0.99));\n\nwill output \"`Mean: 0.852, 99%: 3`\".\n\n### [monitoring](https://github.com/benschmaus/nodeload/tree/master/doc/monitoring.md)\n\nThe `monitoring` module provides a way to track runtime statistics for code that is run concurrently. See [`test/monitoring.test.js`](https://github.com/benschmaus/nodeload/tree/master/test/monitoring.test.js) for examples or read the [monitoring module documentation](https://github.com/benschmaus/nodeload/tree/master/doc/monitoring.md).\n\n    var monitoring = require('nodeload/monitoring');\n    var monitor = new monitoring.Monitor('runtime');\n    function asyncFunction() {\n        var m = monitor.start();\n        setTimeout(function() { m.end(); }, Math.floor(Math.random()*1000));\n    }\n    for (var i = 0; i < 1000; i++) { asyncFunction(); }\n    process.on('exit', function() {\n        console.log('Median runtime (ms): ' + monitor.stats['runtime'].percentile(0.5));\n    });\n\nwill output \"`Median runtime (ms): 497`\".\n\n### [reporting](https://github.com/benschmaus/nodeload/tree/master/doc/reporting.md)\n\nThe `reporting` module provides a way to graph values over time and present it in a auto-updating HTML page. See [`test/reporting.test.js`](https://github.com/benschmaus/nodeload/tree/master/test/reporting.test.js) for examples or read the [reporting module documentation](https://github.com/benschmaus/nodeload/tree/master/doc/reporting.md).\n\n    var reporting = require('nodeload/reporting'), \n        stats = require('nodeload/stats'),\n        report = reporting.REPORT_MANAGER.addReport('Random Numbers'),\n        chart = report.getChart('Gaussian / Pareto vs. Time (minutes)');\n    for (var timeout = 0; timeout < 5000; timeout+=500) {\n        setTimeout(function() {\n                chart.put({\n                    'Pareto': stats.nextPareto(0, 100),\n                    'Gaussian': stats.nextGaussian()\n                });\n            }, timeout);\n    }\n\nwill display a graph on http://localhost:8000/ and save it to an HTML file in the local directory.\n\n### [loop](https://github.com/benschmaus/nodeload/tree/master/doc/loop.md)\n\nThe `loop` module provides a way to execute a function at a set rate and concurrency. See [`test/loop.test.js`](https://github.com/benschmaus/nodeload/tree/master/test/loop.test.js) for examples or read the [loop module documentation](https://github.com/benschmaus/nodeload/tree/master/doc/loop.md) for details.\n\n    var http = require('http'),\n        loop = require('nodeload/loop'),\n        requests = 0,\n        client = http.createClient(80, 'www.google.com'),\n        l = new loop.MultiLoop({\n            fun: function(finished) { \n                client.request('GET', '/').end();\n                requests++;\n                finished();\n            },\n            rps: 10,\n            duration: 3,\n            concurrency: 5\n        }).start();\n    l.on('end', function() { console.log('Total requests: ' + requests) });\n\nwill output \"`Total requests: 30`\".\n\n### [http](https://github.com/benschmaus/nodeload/tree/master/doc/http.md)\n\nThe `http` module provides a generic HTTP server that serves static files and that can be configured with new routes. See [`test/http.test.js`](https://github.com/benschmaus/nodeload/tree/master/test/http.test.js) for examples or read the [http module documentation](https://github.com/benschmaus/nodeload/tree/master/doc/http.md).\n\n    var http = require('nodeload/http');\n    var server = new http.HttpServer().start(10000);\n    server.addRoute('^/hello$', function(url, req, res) {\n        res.writeHead(200);\n        res.end(\"Hello\");\n    });\n\n<http://localhost:8000/package.json> will output the contents of `./package.json`, and <http://localhost:10000/resource> will display \"Hello\".\n\n\nCONTRIBUTING\n================\nFile bugs on [github](https://github.com/benschmaus/nodeload/issues), email any of the authors, and fork away. [doc/developers.md](https://github.com/benschmaus/nodeload/tree/master/doc/developers.md) has brief instructions on getting tests up and running, and will hold more design details in the future. Contributions are always welcome.\n","readmeFilename":"","users":{"tarkeshwar":true,"program247365":true,"jpfeiffer16":true}}