Lightweight load manager for node.js-powered APIs. Executes a range of callbacks as an instance's load rises and falls. Load based on API calls, not server CPU load.
npm install load-manager
# Require and instantiate restify and load-manager api = require('restify').createServer() loadManager = require('load-manager')() # Start the server. api.listen 8080, -> console.log 'listening at %s', api.url # Load must be recorded manually. # This can be achieved most simply as part of some middleware. api.pre (req, res, next) -> loadManager.increment() # It can also be weighted and associated with individal resources # or methods. api.put '/test', (req, res, next) -> loadManager.increment 5 averageLoad = loadmanager.getAverage()