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
3,1011 gold badge18 silver badges27 bronze badges
asked Apr 15, 2017 at 3:20
1
  • Please post full stacktrace of exception. Commented Apr 18, 2017 at 0:30

1 Answer 1

-1

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

answered Oct 18, 2017 at 2:58
Sign up to request clarification or add additional context in comments.

1 Comment

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)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.