Skip to content

thurmda/nerfHerder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nerf Herder

A companion service to mongod to keep long running queries from causing chaos. Every so often config.interval nerfHerder will poll mongo to find a list of current operations. nerfHerder will then loop through each operation and evaluate each rule in config.rules[]. Each rule is passed an operation. The rule can due whatever logic it wants and then return a boolean value. true means the nerf lives, false means the nerf dies. If a rule returns false for an operation killOp will be called to kill it.

Install

git clone git@github.com:thurmda/nerfHerder.git
npm install
npm test

Usage

nerfHerder -d MONGO_CONNECTION_STRING -f PATH_TO_CONFIG

example

nerfHerder -d mongodb://localhost:27017/local -f test/config/config.js

config

module.exports = {
"interval" : .3 * 1000, //Polling interval in miliseconds
"rules" : [
            function(op){/* 'Print op and let it live.' */ console.log(JSON.stringify(op)); return true;},
            function(op){/*Kill everything over 2 secs! */ return (op.secs_running < 2);}
       ]
}

###ref https://www.youtube.com/watch?v=SSwyNN7ms00

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published