Skip to content

Instantly share code, notes, and snippets.

@christianbundy
Created July 29, 2014 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christianbundy/4cafdb7a27a4d696b7bb to your computer and use it in GitHub Desktop.
Save christianbundy/4cafdb7a27a4d696b7bb to your computer and use it in GitHub Desktop.
var system = require('system');
var address = 'http://stress-test.meteor.com';
var i = 0;
var stopping = false;
var newThread = function () {
console.log(i++);
var t = Date.now();
var page = require('webpage').create();
page.open(address, function (status) {
if (status !== 'success') {
console.log('FAIL to load the address');
} else {
t = Date.now() - t;
console.log('Load time: ' + t);
}
});
}
// Start a new thread every second.
setInterval(function () {
if (i < 500) {
newThread();
} else if (stopping === false) {
stopping = true;
// Close after 5 minutes
setTimeout(phantom.exit, 5 * 60 * 1000);
}
}, 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment