Execute a stack with a given 'request-per-seconds' and 'max-requests' rate.
npm install stagger
var stagger = new Stagger(options);
stagger.push(methods);
stagger.start();
stagger.on("progress", handleResponse);
stagger.on("finish", handleDone);
requestsPerSecond
- Number of requests per seconds. Default: 10maxRequests
- Maximum open requests. Default: 20
"progress" Event:
index
- initial stack indexpending
- number of pending callstotal
- total call countcurrent
- current batch sizepercent
- current percentageeta
- estimated total durationcallback
- original callbackvalue
- returned valueduration
- response time
"complete" Event:
total
- total call countduration
- total duration
var Stagger = require("../lib/stagger"),
stagger = new Stagger();
for (var i=0; i<100; i++){
stagger.push(callback);
}
stagger.on("progress", function(event){
console.log(event.value);
});
stagger.on("finish", function(event){
console.log("finish", event.duration);
});
stagger.start();
Martin Kleppe - [email protected]