This video introduces bench-rest, a REST benchmark client which I wrote in Node.js bench-rest makes it easy to define simple sets of REST operations or flows in a simple javascript format and run these as a load test. It gathers the metrics from the run and provides a basic set of statistics. bench-rest’s flow format makes it easy to use unique URL’s or data with your flows using a simple substitution.

bench-rest is built off the shoulders of three fantastic Node.js libraries:

  • Mikeal Roger’s request HTTP client
  • Caolan McMahon’s async asynchronous utilities
  • Felix Geisendörfer’s measured metrics library

In the video I demonstrate bench-rest use as a command line client, but it can also be used programmatically. bench-rest’s flow format for defining the REST operations also allows setup and teardown operations to be performed and actions can be run before or after each operation to further customize or validate the processing.

Goals

  • Introduce bench-rest
  • Demonstrate single method
  • Explain multi-operation flows

Video Info

  • Episode: CW V006
  • Skill level: Beginner with basic Node.js skills
  • Prerequisites:
    • Basic Node.js & npm
    • Basic Bash knowledge
  • Published: May 25th, 2014
  • Tags: js, nodejs,benchmark,REST,free
  • Duration: 9:00
  • Node.js version: 0.10.25

Notes

npm install -g bench-rest` # install
bench-rest # display help

# single GET
bench-rest http://localhost:3000/foo

# GET 100 times, 10 concurrent
bench-rest -n 100 http://localhost:3000/foo

# GET 100 times, 20 concurrent
bench-rest -n 100 -c 20 http://foo/bar

# run flow defined in my-flow.js 100 times
# with 20 concurrent connections
bench-rest -n 100 -c 20 my-flow.js