Created
February 2, 2016 21:52
-
-
Save ltk/8b02621996d6377db0f8 to your computer and use it in GitHub Desktop.
BaaS at Scale | Load Test Process Spawning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const spawn = require('child_process').spawn | |
// How many connections to build with Firebase | |
const maxChildren = 1250 | |
// How long to keep child processes alive | |
const timeout = 10 * 60 * 1000 // 10 minutes | |
for (var i = 0; i < maxChildren; i++) { | |
// your-test.js should contain your application-specific test | |
var child = spawn('node', ['your-test.js', `--id=${i}`, '--timeout=${timeout}']) | |
child.stdout.on('data', (data) => { | |
console.log(`stdout: ${data}`) | |
}); | |
child.stderr.on('data', (data) => { | |
console.log(`stderr: ${data}`) | |
}); | |
child.on('close', (code) => { | |
if (code !== 0) console.log(`Child ${i} process exited with an error. Code ${code}`) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment