测试延迟
redis-cli –latency -h 172.20.27.71 -p 6380
chat sever报错
Alive keeper keep renewing error: redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out
这个是客户端请求的redis超过的原因,现在线上设置的是2s。用上个命令去分析出一般延迟多久,如果超过2s就会报错的。
设置最大连接数
http://www.oschina.net/question/12_88654
$ ./redis-server --maxclients 100000 [41422] 23 Jan 11:28:33.179 # Unable to set the max number of files limit to
100032 (Invalid argument), setting the max clients configuration to 10112.
所以说当你想设置 maxclients 值时,最好顺便修改一下你的系统设置,当然,养成看日志的好习惯也能发现这个问题。
具体的设置方法就看你个人的需求了,你可以只修改此次会话的限制,也可以直接通过sysctl 修改系统的默认设置。如:
ulimit -Sn 100000 # This will only work if hard limit is big enough.
sysctl -w fs.file-max=100000