JedisConnectionException: java.net.SocketTimeoutException: Read timed out

wangxi得 发布于 2016/01/25 09:28
阅读 6K+
收藏 0

【Gopher China万字分享】华为云的Go语言云原生实战经验!>>>

Exception in thread "Thread-2" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: Read timed out
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:201)
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
at redis.clients.jedis.Protocol.process(Protocol.java:132)
at redis.clients.jedis.Protocol.read(Protocol.java:196)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:288)
at redis.clients.jedis.Connection.getRawObjectMultiBulkReply(Connection.java:233)
at redis.clients.jedis.JedisPubSub.process(JedisPubSub.java:108)
at redis.clients.jedis.JedisPubSub.proceedWithPatterns(JedisPubSub.java:95)
at com.cms.redis.RedisAPI.getPool(RedisAPI.java:30)
at com.cms.socket.client.RequestServer.run(RequestServer.java:62)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:152)
at java.net.SocketInputStream.read(SocketInputStream.java:122)
at java.net.SocketInputStream.read(SocketInputStream.java:108)
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:195)
... 10 more

用jedis,产生的异常这个一般是怎么引起的?如何解决?

用:jedis2.7.jar ,配置参数如下:

  JedisPoolConfig config = new JedisPoolConfig();
            config =new JedisPoolConfig();
            config.setMaxTotal(100);//设置最大连接数  
            config.setMaxIdle(50); //设置最大空闲数 
            config.setMinIdle(1);
            config.setMaxWaitMillis(3000);//设置超时时间  
            config.setTestOnBorrow(true);
            jedispool = new JedisPool(config, "10.96.10.225", 6379,300000,"password2011");


加载中
1
Vchen557
Vchen557
我遇到过这个问题,当时我把redis存了400W的数据(单台机器),遍历一直会出现这个现象。
1
士别三日
士别三日
socket通信超时,原因一,业务执行时间超过3秒,比如要批量处理大量数据;原因二,redis服务器性能问题,处理时间过慢;原因三,同一jedis对象同时被多个线程使用,看起来不像这个原因
0
wangxi得
wangxi得
redis 用完实例需要返还给pool 解决此问题
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部