Last active
August 29, 2015 14:18
-
-
Save megastef/9f1ef2244d80fc9a7300 to your computer and use it in GitHub Desktop.
spm-hapi.js
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
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(); |
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
# 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