Skip to content

Instantly share code, notes, and snippets.

@fengmk2
Created August 12, 2012 13:18
Show Gist options
  • Save fengmk2/3331780 to your computer and use it in GitHub Desktop.
Save fengmk2/3331780 to your computer and use it in GitHub Desktop.
Mongodb blackhole
var mongodb = require('mongodb');
var blackhole = require('net').createServer(function (c) {
// console.log('new connection:', c.server._connectionKey);
c.end();
});
blackhole.listen(24008, function () {
console.log('BlackHole listened at "' + 24008 + '"');
var replSet = new mongodb.ReplSetServers( [
new mongodb.Server('127.0.0.1', 24008, { auto_reconnect: true } )
]
);
var client = new mongodb.Db('test', replSet);
client.open(function (err, p_client) {
console.log(err);
});
});
@fengmk2
Copy link
Author

fengmk2 commented Aug 12, 2012

run this script, and look at the CPU load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment