How Jedis Pool works?

You haven’t configured the maxTotal size of the pool, and the default value is only 8. You could change the JedisFactory constructor to:


    public JedisFactory() {
        JedisPoolConfig poolConfig = new JedisPoolConfig();
        poolConfig.setMaxTotal(128);
        jedisPool = new JedisPool(poolConfig, RedisDBConfig.HOST, RedisDBConfig.PORT, RedisDBConfig.TIMEOUT, RedisDBConfig.PASSWORD);
    }

Beware also of the default value of the WhenExhaustedAction (WHEN_EXHAUSTED_BLOCK), as it may not be your desired behavior.

Jedis uses Apache Commons Pool, and you can read about its parameters here: GenericObjectPool

Leave a Comment

tech