Permalink
Browse files

s.setNoDelay(true), update version to 0.1.1

  • Loading branch information...
fengmk2 committed Aug 28, 2012
1 parent 814254d commit b04778071a9e2a5a47516daebe16c8f175b92460
Showing with 7 additions and 3 deletions.
  1. +2 −1 benchmark/proxy.js
  2. +2 −1 benchmark/start.sh
  3. +2 −0 lib/agent.js
  4. +1 −1 package.json
@@ -14,6 +14,7 @@ var http = require('http');
var Agent = require('../');

var maxSockets = parseInt(process.argv[2], 10) || 10;
var SERVER = process.argv[3] || '127.0.0.1';

var agentKeepalive = new Agent({
maxSockets: maxSockets,
@@ -87,7 +88,7 @@ http.createServer(function (req, res) {
rts = rtKeepalives;
}
var options = {
host: 'localhost',
host: SERVER,
port: 1984,
path: path,
method: method,
@@ -5,6 +5,7 @@ sudo sysctl -w net.inet.tcp.msl=1000
sudo sysctl -w kern.maxfiles=1000000 kern.maxfilesperproc=1000000
sudo ulimit -n 100000

SERVER=127.0.0.1
NUM=1000
CONCURRENT=60
maxSockets=50
@@ -15,7 +16,7 @@ node sleep_server.js &

sleep_server_pid=$!

node proxy.js $maxSockets &
node proxy.js $maxSockets $SERVER &

sleep 1

@@ -99,6 +99,8 @@ Agent.prototype.createSocket = function (name, host, port, localAddress, req) {
s.destroy();

This comment has been minimized.

@aleafs

aleafs Aug 30, 2012

如果这个socket不在空闲状态,会断掉正在进行的通信吗?

This comment has been minimized.

@fengmk2

fengmk2 Sep 12, 2012

Member

会的,node http server默认设置了一个60秒的空闲超时,会关掉socket。而且,nginx默认是30秒,所以会更早关闭。

self.timeoutSocketCount++;
});
// Disable Nagle's algorithm: http://blog.caustik.com/2012/04/08/scaling-node-js-to-100k-concurrent-connections/
s.setNoDelay(true);
}
this.createSocketCount++;
return s;
@@ -1,6 +1,6 @@
{
"name": "agentkeepalive",
"version": "0.1.0",
"version": "0.1.1",
"description": "Missing keepalive http.Agent",
"main": "index.js",
"directories": {

0 comments on commit b047780

Please sign in to comment.