Created
October 20, 2015 02:15
-
-
Save tlivings/1bfe110899b68fff9d22 to your computer and use it in GitHub Desktop.
Testing connect time
This file contains hidden or 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
wrk -c 30 -d 30s -t 30 http://127.0.0.1:8888 |
This file contains hidden or 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
'use strict'; | |
var Http = require('http'); | |
var server = Http.createServer(function (req, res) { | |
res.writeHead(200); | |
res.end('OK'); | |
}); | |
server.listen(8887); |
This file contains hidden or 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
'use strict'; | |
var Http = require('http'); | |
var server = Http.createServer(function (req, res) { | |
var request = Http.request({ | |
method: 'GET', | |
hostname: '127.0.0.1', | |
port: 8887 | |
}, function (response) { | |
res.writeHead(200); | |
res.end(); | |
}); | |
request.once('socket', function (socket) { | |
var start = Date.now(); | |
socket.once('connect', function () { | |
var time = Date.now() - start; | |
if (time > 100) { | |
console.log('connect in %d/ms.', time); | |
} | |
}); | |
}); | |
request.end(); | |
}); | |
server.listen(8888); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment