I am trying to configure the Jedis connection pool. Below are my settings:
jedisConFactory.getPoolConfig().setMaxTotal(30);
jedisConFactory.getPoolConfig().setMaxIdle(10);
jedisConFactory.getPoolConfig().setMinIdle(5);
jedisConFactory.getPoolConfig().setBlockWhenExhausted(true);
jedisConFactory.setTimeout(10000); // enable this causing exception
I have set setMaxTotal
to a fixed value in the above code, however the number of connections on Redis server still keeps increasing.
I expect the Pool is able to maintain the number of connections on a right amounts and could not exceed the MaxTotal value.
My question is:
Immediately after a pool closes a connection, the Redis server will also close this connection immediately or will it still hold the connection for some time? Which factor controls this feature?
Also if I enable jedisConFactory.setTimeout(10000)
, sometimes it throws an exception:
JedisConnectionException: Unexpected end of stream....