Node.js服务器在I/O和大量客户端连接方面非常有效.但是,与传统的多线程服务器相比,为什么node.js不适合繁重的CPU应用?
我在这里读到Felix Baumgarten
有人可以解释如何使用request.js池哈希?
关于池的github笔记说:
pool - 包含这些请求的代理的哈希对象.如果省略,则此请求将使用设置为节点的默认maxSockets的全局池.
pool.maxSockets - 包含池中最大套接字数量的整数.
我有这个代码写入CouchDB实例(注意问号).基本上,连接到我的节点服务器的任何用户都将相互独立地写入数据库:
var request = require('request');
request({
//pool:, // ??????????????????
'pool.maxSockets' : 100, // ??????????????????
'method' : 'PUT',
'timeout' : 4000,
'strictSSL' : true,
'auth' : {
'username' : myUsername,
'password' : myPassword
},
'headers' : {
'Content-Type': 'application/json;charset=utf-8',
'Content-Length': myData.length
},
'json' : myData,
'url': myURL
}, function (error, response, body){
if (error == null) {
log('Success: ' + body);
}
else {
log('Error: ' + error);
}
});
Run Code Online (Sandbox Code Playgroud)
什么是最佳的高吞吐量/性能? …