Actually now that I look at the Agent code, it looks like it sets maxSockets on a per domain basis in an Agent:

 Agent.prototype.addRequest = function(req, host, port) {
var name = host + ':' + port;
if (!this.sockets[name]) {
this.sockets[name] = [];
}
if (this.sockets[name].length < this.maxSockets) {
// If we are under maxSockets create a new one.
req.onSocket(this.createSocket(name, host, port));
} else {
// We are over limit so we'll add it to the queue.
if (!this.requests[name]) {
this.requests[name] = [];
}
this.requests[name].push(req);
}
};

What is the expected behavior of maxSockets on an Agent?  Should maxSockets represent the total number of sockets available to that agent, or the total number of sockets available to each host:port in that agent?  My vote is for the former, since it's possible to build the later on top of it, but not vice versa.

上面的意思就是如果你在代理对象上设置了 maxSockets 这个属性,那对于每一个域名下的 sockets 数量就应该≤ 这个数目,有新的req进来,看看有没有超,没超过,就加进去,超了,就先放放在这个域名下的队列里。

最新文章

  1. Android开发学习之路-EventBus使用
  2. java多线程解读一(基础篇)
  3. iOS播放器 - AVPlayer
  4. POJ 1753 Flip Game 状态压缩,暴力 难度:1
  5. RPI学习--webcam_用fswebcam抓取图片
  6. javascript面向对象和原型
  7. Extjs datefield 日历控件中文显示
  8. 一、Openstack_Ocata环境部署准备
  9. 表格布局扩展/DW设计界面中快速整体布局页面的操作
  10. ubuntu:通过封装验证码类库一步步安装php的gd扩展
  11. 基础概念PHP-FPM、FastCGI和CGI
  12. Delphi 2010 新增功能之: IOUtils 单元(6): TPath(结构体) 的方法与属性
  13. Oracle 11g:bin目录下3个特效权限的文件:root用户所有者 + s权限
  14. ListBox 控件单击事件
  15. ACM1012:u Calculate e
  16. jni 找不到本地方法的实现
  17. 使用RawComparator加速Hadoop程序
  18. scrapy 爬取天猫商品信息
  19. 炒鸡简单的javaScript的call和apply方法
  20. ZOJ - 3430 Detect the Virus —— AC自动机、解码

热门文章

  1. zabbix之2安装编译/基本功能实现
  2. ZOJ 3745 Salary Increasing
  3. C语言中预定义符 __FILE__, __LINE__, __FUNCTION__, __DATE__, __TIME__ 的使用演示
  4. Slack 开源替代品 Rocket.Chat(聊天,文件上传等等)
  5. 【转】如何设置无线路由器的信道以获得最佳WIFI体验?
  6. Eclipse插件Mylyn管理上下文任务管理
  7. Reverse Linked List 解答
  8. PKU 3667 Hotel(线段树)
  9. 委托、Lambda表达式
  10. Android_Fragment_Fragment具体解释