0
点赞
收藏
分享

微信扫一扫

[Azure Redis]If you get java.net.SocketTimeoutException: Read timed out exception

If you get ​​java.net.SocketTimeoutException: Read timed out​​ exception

Try setting own ​​timeout​​​ value when constructing ​​JedisPool​​ using the following constructor:

JedisPool(GenericObjectPoolConfig poolConfig, String host, int port, int

where ​​timeout​​ is given as milliseconds.

Default ​​timeout​​ value is 2 seconds.

JedisPool blocks after getting 8 connections

JedisPool defaults to 8 connections, you can change this in the PoolConfig:

JedisPoolConfig poolConfig = new JedisPoolConfig();
poolConfig.setMaxTotal(maxTotal); // maximum active connections
poolConfig.setMaxIdle(maxIdle); // maximum idle connections

Take into account that ​​JedisPool​​​ inherits commons-pool ​​BaseObjectPoolConfig​​​ which has a lot of configuration parameters. We've set some defined ones which suit most of the cases. In case, you experience ​​issues​​ tuning these parameters may help.

 

Reference: ​​https://github.com/xetorthio/jedis/wiki/FAQ#if-you-get-javanetsockettimeoutexception-read-timed-out-exception​​

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!



举报

相关推荐

0 条评论