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
3,1011 gold badge18 silver badges27 bronze badges
-
Please post full stacktrace of exception.Sheinbergon– Sheinbergon2017年04月18日 00:30:54 +00:00Commented Apr 18, 2017 at 0:30
1 Answer 1
maxTotal=5, I thought 5 is too small, you can set it to e.g,20.
Sign up to request clarification or add additional context in comments.
1 Comment
S4NDM4N
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - [From Review] (stackoverflow.com/review/late-answers/17657843)