cluster-client icon indicating copy to clipboard operation
cluster-client copied to clipboard

Sharing Connection among Multi-Process Nodejs

Results 5 cluster-client issues
Sort by recently updated
recently updated
newest added

代码 ``` class MongoDataClient extends Base { constructor(args) { super(args); this.ready(true); } async find(collectionName, ...rest) { rest.pop(); //需要手动去掉callback const db = await mongoClient; return db.collection(collectionName).find(...rest).toArray(); } } ``` 结合leader代码 ```...

在clusterClient模式下, 手贱去telnet了下端口,结果程序crash了. 看了下, lib/server.js ``` if (!header) { header = socket.read(24); if (!header) { return; } } if (!bodyLength) { bodyLength = header.readInt32BE(16) + header.readInt32BE(20); } ``` header = socket.read(24)在connection断开后,header是有值的,...

https://nodejs.org/dist/latest-v10.x/docs/api/v8.html#v8_serialization_api node 8 开始有 v8 自带的序列化方法,如果是2个 node 进程之间交换数据,是它会更加合适。

enhancement

2018-05-03 09:20:29,856 WARN 6632 nodejs.ClusterClientConnectTimeoutError: socket#127.0.0.1:50043 connect timeout(1000ms) at Socket.socket.setTimeout (...\node_modules\cluster-client\lib\server.js:205:19) at Socket.g (events.js:291:16) at emitNone (events.js:86:13) at Socket.emit (events.js:185:7) at Socket._onTimeout (net.js:339:8) at ontimeout (timers.js:365:14) at tryOnTimeout (timers.js:237:5) at...

```js ERROR 162 nodejs.ServerNoResponseError: server 127.0.0.1:47949 no response in 32236ms, maybe the socket is end on the other side. (address: 127.0.0.1:47949) at Timeout._heartbeatTimer.setInterval [as _onTimeout] (/home/admin/app/node_modules/[email protected]@tcp-base/lib/base.js:427:21) at ontimeout (timers.js:475:11) at...