[英]How make http.globalAgent.maxSockets works on expressjs?
I see number of posts on this platform giving the same solution which does not work for me, so here is my very simple node program I would like to understand why it still appears to process requests 6 by 6 instead of what I setup in http.globalAgent.maxSockets
? 我看到该平台上的帖子数量提供了对我不起作用的相同解决方案,因此这是我非常简单的节点程序,我想理解为什么它仍然显示出6 x 6的处理请求,而不是我在
http.globalAgent.maxSockets
设置的处理程序http.globalAgent.maxSockets
?
var http = require('http');
http.globalAgent.maxSockets = 10;
var express = require('express');
var app = express();
app.use('/', function(req, res, next){
console.log('Request /');
setTimeout(function(){
res.send('ok');
console.log('Handled');
}, 2000);
});
app.listen(3309);
console.log('Server up.');
Thank you very much... 非常感谢你...
目前尚不清楚您尝试解决什么问题,但是http.globalAgent
是单例http 客户端 ,因此它不会以任何方式影响您的代码。
Ok, my problem was the client used to execute request: Google Chrome Chrome has a 6 connexion per host limitation. 好的,我的问题是用于执行请求的客户端:Google Chrome Chrome的每个主机限制为6个连接。 So neither node/angular or some other framework is concerned by this issue.
因此,此问题都不会涉及节点/角度或其他框架。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.