diff --git a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisAPIProducer.java b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisAPIProducer.java index 5db2ce94b2216d..3c3832b904fe7b 100644 --- a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisAPIProducer.java +++ b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisAPIProducer.java @@ -68,6 +68,13 @@ public RedisAPIProducer(RedisConfig config, Vertx vertx) { timeout = config.timeout.get().getSeconds(); } + options.setMaxPoolSize(config.maxPoolSize); + options.setMaxPoolWaiting(config.maxPoolWaiting); + options.setPoolRecycleTimeout(Math.toIntExact(config.poolRecycleTimeout.toMillis())); + if (config.poolCleanerInterval.isPresent()) { + options.setPoolCleanerInterval(Math.toIntExact(config.poolCleanerInterval.get().toMillis())); + } + vertxRedisClient = Redis.createClient(vertx, options); redisAPI = RedisAPI.api(vertxRedisClient); mutinyRedisClient = io.vertx.mutiny.redis.client.Redis.newInstance(vertxRedisClient); diff --git a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisConfig.java b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisConfig.java index 321ff1a26e9c78..bba011bcd202bc 100644 --- a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisConfig.java +++ b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisConfig.java @@ -48,4 +48,30 @@ public class RedisConfig { */ @ConfigItem(defaultValue = "standalone") public RedisClientType clientType; + + /** + * The maximum size of the connection pool. When working with cluster or sentinel. + *
+ * This value should be at least the total number of cluster member (or number of sentinels + 1)
+ */
+ @ConfigItem(defaultValue = "6")
+ public int maxPoolSize;
+
+ /**
+ * The maximum waiting requests for a connection from the pool.
+ */
+ @ConfigItem(defaultValue = "24")
+ public int maxPoolWaiting;
+
+ /**
+ * The duration indicating how often should the connection pool cleaner executes.
+ */
+ @ConfigItem
+ public Optional