We are facing issues while connection to Redis in out localhost through spring-data-redis (spring boot application).
Data collected through profiler
Issue 1: Most of the time application is spending in getConnection(), releaseConnection() and socket IOs.
Sample Code :-
public void addValuesInSet(){
long startTime = System.currentTimeMillis();
for(int i = 1; i < 2000 ; i++) {
final String tempKey = i + "";
for (int j = 0; j < 100; j++) {
redisTemplate.boundHashOps(tempKey).put( j +"" , j + "");
}
}
long endTime = System.currentTimeMillis();
System.out.println("total time : " + (endTime - startTime));
}
Issue 2: Even with idle connection available in pool, application is trying to create more collection.
spring.redis.pool.max-idle=100
spring.redis.pool.max-active=100
spring.redis.pool.max-wait=-1
spring.redis.pool.min-idle=50
Is there any way to improve on this?