jeffbski / bench-rest

bench-rest - benchmark REST (HTTP/HTTPS) API's. node.js client module for easy load testing / benchmarking REST API's using a simple structure/DSL can create REST flows with setup and teardown and returns (measured) metrics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On progress event not logging output

omesanni opened this issue · comments

Hi,
From the code below, I noticed that the on progress event never outputs anything. I was wondering why this is the case. Anytime i run my bench-rest script in the node terminal, i don't see anything until the whole iteration is completed.

 benchrest(flow, runOptions)
    .on('error', function (err, ctxName) { 
      console.error('Failed in %s with err: ', ctxName, err); 
    })
    .on('progress', function (stats, percent, concurrent, ips) {
      console.log('Progress: %s complete', percent);
    });

It would have been nice to see some output as its progressing so I have a sense of what is going on.

Thanks

To enable the progress output you need to set the run option progress with a millisecond timer frequency about how often you want progress to be output.

It will then give you the current stats, percent of iterations complete, concurrent request count, an average iterations per second.

If you are calling this from the command line using bench-rest command then a default progress of 1000 ms is used unless you override with the --progress option. So by default your run would need to take more than 1 second to begin seeing progress updates.

Note: the percent complete calculation only looks at the number of iterations completed / total iterations desired, so it will not track partial iteration completions, but usually that is fine since we typically run lots of iterations not just 1.

So set the run option progress and let me know if that fixes your issue. It should since the command line version uses that same feature and it works from there.