ioredis cluster access to the redis database, in the same second, there are several times out of 80 milliseconds, I would like to ask what is the cause of this.
var Redis = require('ioredis');
var redisClient = {};
redisClient.getRedisClient = function(callback){
var cluster = new Redis.Cluster([
{port:1234,host:'127.0.0.1'},
{port:1235,host:'127.0.0.1'}
],{
redisOptions:{password:'password'}
});
return cluster;
}
module.exports = redisClient;
It seems to be a network problem.
是网络原因吧,看你具体的网络环境了
Network no problem, the network delay between the nodejs server and the redis server is 2 to 3 ms, just in the same second, the emergence of redis query timeout of 80 milliseconds or more, I would like to ask this and ioredis cluster package is associated with it?
网络没问题,nodejs服务器与redis服务器之间的网络延时是2到3毫秒,只是在同一秒中出现redis查询超时80毫秒以上,请问这与ioredis集群包有关联吗?
和 ioredis 无关的,超时原因很多,比如网络 RTT 比较高或者 Redis 线程阻塞。
如果根据你说的存在redis线程阻塞,我已经让我们公司DBA查了redis数据库的日志,都没有找到超时50毫秒以上的。
并且我们有用java调用redis集群,都没有存在redis线程阻塞这种情况。
From: Zihua 子骅
Date: 2016-10-10 23:34
To: luin/ioredis
CC: zhaozhi1989; Author
Subject: Re: [luin/ioredis] ioredis cluster access to the redis database, in the same second in a number of times out of 80 milliseconds (#377)
和 ioredis 无关的,超时原因很多,比如网络 RTT 比较高或者 Redis 线程阻塞。
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
嗯,排除超时的话就是网络问题或者 Node.js 这边 CPU 阻塞了。把 ioredis 和 java 的代码放到同一个网络环境看看,如果还有问题,确认下是不是 Redis Cluster 返回的数据比较大,JavaScript 的 parser 处理不过来
Redis Cluster返回的数据不大,value值都很小,并且parser解析是用的hiredis这个包,
目前nodejs现在用的是单线程,在做压力测试时观看cpu消耗情况,有是会达到100%,
请问cpu过高会造成redis连接超时吗?
另外您那边有没有express.js框架开启多少cluster的例子。
From: Zihua 子骅
Date: 2016-10-10 23:57
To: luin/ioredis
CC: zhaozhi1989; Author
Subject: Re: [luin/ioredis] ioredis cluster access to the redis database, in the same second in a number of times out of 80 milliseconds (#377)
嗯,排除超时的话就是网络问题或者 Node.js 这边 CPU 阻塞了。把 ioredis 和 java 的代码放到同一个网络环境看看,如果还有问题,确认下是不是 Redis Cluster 返回的数据比较大,JavaScript 的 parser 处理不过来
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
如果 CPU 达到 100% 必然会导致阻塞的
目前服务器的配置是4核16G,压力测试的时候是50个并发,有没有什么办法能降低CPU的消耗?
子骅,我今天把nodejs开了多线程,cpu降下来了,但是reids查询还是有还多超时,你能分析下是什么原因吗?谢谢!
From: Zihua 子骅
Date: 2016-10-11 00:08
To: luin/ioredis
CC: zhaozhi1989; Author
Subject: Re: [luin/ioredis] ioredis cluster access to the redis database, in the same second in a number of times out of 80 milliseconds (#377)
如果 CPU 达到 100% 必然会导致阻塞的
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.