Support runtime warm-up of Redis node connection pools
Motivation
Redisson already provides static minimum idle settings such as masterConnectionMinimumIdleSize, slaveConnectionMinimumIdleSize, and subscriptionConnectionMinimumIdleSize. Those settings define the baseline pool size during client initialization.
Some applications need to prepare additional regular command connections at runtime without recreating the Redisson client or permanently changing its minimum idle configuration.
A primary use case is an application-level circuit breaker that temporarily bypasses Redis cache traffic. While the circuit is open, the pool may remain at its configured minimum idle size. Before moving the circuit to half-open or closed and restoring cache traffic, the application can await the warm-up operation to prepare the desired connection capacity. Configuring a larger minimum idle size would retain those additional connections permanently, even when they aren't needed.
Proposed API
Expose a runtime warm-up API on Redis master, slave, and cluster node objects:
node.warmUpConnectionPoolAsync(connectionAmount)
.whenComplete((res, ex) -> {
if (ex == null) {
// the pool contains the requested connection amount
}
});Semantics
connectionAmountis the target total number of regular command connections in the node pool.- Connections currently borrowed by commands are included in that number.
- If the pool already contains the requested amount, the future completes without creating connections.
- Missing connections are created asynchronously while respecting the configured max pool size.
- Concurrent warm-up requests are serialized.
- A failed warm-up doesn't close or remove existing healthy pool connections.
Related PR
Implemented in #7235.
Source: redisson/redisson