将节点http请求发送到Docker Remote API – 无响应
我的NodeJS应用程序与Docker远程API对话并pipe理Docker容器。 我使用AJAX与我的nodejs应用程序交谈。
问题:
第6个请求从不接收来自Docker Remote API的响应。 只有前5个请求得到回应。
示例应用程序
https://gist.github.com/boopathi/8156caa3bbd09d17685f#file-infinite-js
node infinite.js
停止5次后,一直等待。
只发生在Node上。 尝试使用curl和golang,并没有发生。
为infinite.jsparsingmtrace输出: https : //gist.github.com/boopathi/8156caa3bbd09d17685f#file-infinite-mtrace
将最大套接字增加到一些更高的值。
http.globalAgent.maxSockets = 100;
或者,您可以通过在请求中传递代理参数来禁用套接字池。
var req = http.request({ agent: false, ... }, successCallback);
参考1: http : //nodejs.org/api/http.html#http_agent_maxsockets
参考2: http : //nodejs.org/api/http.html#http_class_http_agent