Skip to content
M Sazzadul Hoque edited this page Feb 17, 2022 · 9 revisions

Frequently Asked Questions

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 timeout)

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.

How to configure the buffer size of socket(s)

The buffer size of all Jedis sockets in an application can be configured through system property.

Buffer size of input stream can be configured by setting jedis.bufferSize.input or jedis.bufferSize system property.
Buffer size of output stream can be configured by setting jedis.bufferSize.output or jedis.bufferSize system property.
If you want to set the buffer size of both input and output stream to same value, you can just set jedis.bufferSize.

Note: This feature is available since Jedis 4.2.0.

Clone this wiki locally