Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Understanding maxTotal, maxIdle and minIdle

25 views
Skip to first unread message

Joan Balagueró

unread,
Jan 14, 2025, 8:22:21 AMJan 14
to Jedis
Hello,

I have the following 'GenericObjectPoolConfig' config:
 
  GenericObjectPoolConfig<Jedis> config = new GenericObjectPoolConfig<>();
  config.setMaxTotal(100);
  config.setMaxIdle(60);
  config.setMinIdle(60);
  config.setSoftMinEvictableIdleDuration(Duration.ofSeconds(3600));
  config.setLifo(false);
  config.setFairness(false);
  config.setBlockWhenExhausted(false);
  config.setJmxEnabled(false);
 

Setting maxIdle = minIdle = 60, I expected to always see, at least, 60 connections established between our application and redis.
But below the number of established connections I can see in differents periods:

Time #Established
----
12.42:17 27
12:42:23 27
12:42:28 28
12:42:34 47
12:42:39 44
12:42:45 44
12:42:50 44
12:42:56 32
12:43:01 31
12:43:07 37
12:43:13 36
12:43:18 60
12:43:24 60
12:43:29 60
12:43:35 56
12:43:40 49
12:43:46 41
12:43:51 38
12:43:57 38
12:44:08 27
12:44:13 23
12:44:19 29
12:44:24 29
12:44:30 66
12:44:35 54
12:44:41 53
12:44:46 47
12:44:52 29
12:44:57 29


What's the reason to stay lower than 60 most of the time?

Thanks,

Joan.

Sazzadul Hoque

unread,
Jan 14, 2025, 8:37:27 AMJan 14
to jedis...@googlegroups.com
What is the timeout in your Redis server? Could it be possible that client connections (at least some of them) were disconnected from the server side?

BTW, did you check the matrices (counts) in the Java application? E.g. getNumActive(), getNumIdle(), etc.

--
You received this message because you are subscribed to the Google Groups "Jedis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jedis_redis...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jedis_redis/3c0fa08f-1fa2-4030-83c0-b90fcdeb4c8en%40googlegroups.com.

Joan Balagueró

unread,
Jan 14, 2025, 8:55:56 AMJan 14
to Jedis
Hi Sazzadul,

Many thanks for your quick response.

Just for my understanding. Suppose this pool with maxTotal = 100 and maxIdle = minIdle = 60. I start my application and imagine I constantly see 80 requests to redis, so numActive = 80. Now redis drops 40 connections, what will jedis do? Automatically start 20 more connections to honor the minIdle = 60 parameter? Or a connection becomes idle only if first is used and established, and once the connection finishes then it's moved to idle state?

So, with this config, when I start the pool (still with no traffic) should I see 60 connections established?

Let me ask my customer about the redis timeout ... I don't have this counters enabled.

Thanks,
Joan.

Sazzadul Hoque

unread,
Jan 14, 2025, 9:04:27 AMJan 14
to jedis...@googlegroups.com
what will jedis do?

It is actually commons-pool or, to be more specific, the version of commons-pool that decides what will happen.

Oscar Besga

unread,
Jan 26, 2025, 4:49:14 PMJan 26
to Jedis
See here
https://stackoverflow.com/questions/28364855/what-is-the-difference-between-maxtotal-and-maxidle-in-apache-commons-pool-2
I suspect jedis no-idle no-used connections will be mantained opened with ECHO commands

Hope it helps



Reply all
Reply to author
Forward
0 new messages