1

We are using redis for caching purpose in our application.

Our goal is to create new Redis connections as the pool size exhaust or crosses a certain threshold so that we can keep the number of idle connections minimal . This way a redis-server resource is allocated to a application-server which really needs it.

In our java application we are using spring's JedisConnectionFactory of spring-data-redis 1.4.2 which internally uses Jedis 2.6.2 and commons-pool 2.0 .

The latest versions of GenericObjectPool does not have option of growing pool size dynamically. (Earlier versions of commons-pool had whenExhaustAction option)

I also could not find a way to pass a custom object pool in Jedis.

Please suggest how can we achieve this. Does any other Redis-Client has a support for this?

ankur garg
  • 71
  • 1
  • 5

1 Answers1

1

If you set the maxTotal property to a negative value, there will be no limit to the number of instances in the pool. You can combine this with a maxIdle setting to ensure that there are no more than maxIdle idle connections at any given time.

Phil Steitz
  • 644
  • 3
  • 10