Name: arrivals
Owner: Shoreditch Ops
Description: Model the arrival of events in a system (Poisson or constant process)
Created: 2015-07-18 04:16:23.0
Updated: 2018-05-02 08:50:02.0
Pushed: 2017-07-12 18:44:12.0
Size: 13
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
arrivals
models arrival events in a system, e.g.:
This library was originally developed for use in Artillery, a modern load testing toolkit.
npm install arrivals
Two models of arrival processes are available: Poisson and Uniform (arrivals at a specified constant rate).
oisson process example
arrivals = require('arrivals');
reate a Poisson process with the mean inter-arrival time of 500 ms that
ill run for 20 seconds:
p = arrivals.poisson.process(500, 20 * 1000);
('arrival', function onArrival() {
nsole.log('New arrival, %s', new Date());
ce('finished', function() {
nsole.log('We are done.');
art();
If the last argument (total duration of the process) is omitted, the process
will run until stopped with p.stop()
.
niform arrivals example:
arrivals = require('arrivals');
reate an arrivals process that will trigger the callback every 500ms for
0 seconds (for a total of 20000 / 200 = 40 arrivals)
p = arrivals.uniform.process(500, 20 * 1000);
('arrival', function onArrival() {
nsole.log('New arrival, %s', new Date());
ce('finished', function() {
nsole.log('We are done.');
art();
The last argument (total duration) is optional as in the previous example.
This software is distributed under the terms of the ISC license.
right (c) 2015-2017, Hassy Veldstra <h@artillery.io>
ission to use, copy, modify, and/or distribute this software for any
ose with or without fee is hereby granted, provided that the above
right notice and this permission notice appear in all copies.
SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
RD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
RECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
R TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
ORMANCE OF THIS SOFTWARE.