0

I'm using spring-data-redis to access redis(one machine) with xml config file, on beginning, everything is ok, but after some minutes, i run my test again, i got "could not get a resource from the pool" exception, i haved searched some answers, i guess this reason is the connections did

not return to the pool, how to solve this problem, why this problem can be occur, i'm using redis-3.2.6 spring-data-redis1.8 jedis2.9, below is my config

#Redis settings
redis.host=27.57.100.3
redis.port=6379
redis.pass=

maxTotal=5
maxIdle=3
minIdle=1
maxWaitMillis=10000
testOnBorrow=true
testOnReturn=true
testWhileIdle=true
timeBetweenEvictionRunsMillis=30000
numTestsPerEvictionRun=10
minEvictableIdleTimeMillis=60000
softMinEvictableIdleTimeMillis=10000
blockWhenExhausted=true

And here is my code :

@Autowired
StringRedisTemplate stringRedisTemplate

@Test
public void test(){
    ValueOperations<String, String> vop = stringRedisTemplate.opsForValue();
    String k = "k";
    String v = "v";
    vop.set(k, v);
    String value = vop.get(k);
}
Sheinbergon
  • 2,875
  • 1
  • 15
  • 26
PPTV
  • 1
  • 1

1 Answers1

-1

maxTotal=5, I thought 5 is too small, you can set it to e.g,20.

hugo
  • 45
  • 2
  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker.](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead) - [From Review] (https://stackoverflow.com/review/late-answers/17657843) – S4NDM4N Oct 18 '17 at 03:31