node-throttler is a HTTP traffic throttler.
npm install node-throttler
node-throttler is built on top of node-http-proxy. It provides following features.
proxy --config <config_file> --log <log_level>
where config is a JSON configuration file and log defines the logging level.
The configuration file is itself a JSON object consists of following fields.
the port on which the throttler will listen
the host of the remote service to be throttled
the port of the remote service to be throttled
either rps or averesp
defines how the throttle rate key is calculated from the request object. If absent, a constant value is used which means the same threshold value will be applied to all requests
defines how the threshold value is calculated for a request. If it is a constant number, then the value will be applied to all requests
defines the maximum throttle time allowed.
Following fields only apply to rps style
Following fields only apply to averesp style
the oldest sample that can be used to compute average response time
the minimum sampel size required to compute average response time
the maximum sampel size required to compute average response time