Skip to content

Instantly share code, notes, and snippets.

@megastef
Last active August 29, 2015 14:18
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 megastef/9f1ef2244d80fc9a7300 to your computer and use it in GitHub Desktop.
Save megastef/9f1ef2244d80fc9a7300 to your computer and use it in GitHub Desktop.
spm-hapi.js
var Hapi = require('hapi');
// set before process.env.SPM_TOKEN | process.env.spmagent_tokens__spm
// see http://blog.sematext.com/2015/03/30/nodejs-iojs-monitoring/
var agent = require ('spm-agent-nodejs')
// Create a server with a host and port
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: 8000
});
// Add the route
server.route({
method: 'GET',
path:'/hello',
handler: function (request, reply) {
reply('hello world');
}
});
// Start the server
server.start();
# sudo apt-get install siege
siege http://localhost:8000/hello -c500 -t24h &
# will generate errors -> error rate
siege http://localhost:8000/ -c10 -t24h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment