You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the configuration here, we've set a sliding window size of 10 and a failure rate threshold of 50%.
92
-
This means that a failover will be triggered if 5 out of any 10 calls to Redis fail.
96
+
In the configuration here, we've set a sliding window size of 1000 and a failure rate threshold of 50%.
97
+
This means that a failover will be triggered only if both 500 out of any 1000 calls to Redis fail (i.e., the failure rate threshold is reached) and the minimum number of failures is also met.
93
98
94
99
You can now use this `MultiDbClient` instance, and the connection management and failover will be handled transparently.
95
100
@@ -98,22 +103,22 @@ You can now use this `MultiDbClient` instance, and the connection management and
98
103
Under the hood, Jedis' failover support relies on [resilience4j](https://resilience4j.readme.io/docs/getting-started),
99
104
a fault-tolerance library that implements [retry](https://resilience4j.readme.io/docs/retry) and [circuit breakers](https://resilience4j.readme.io/docs/circuitbreaker).
100
105
101
-
Once you configure Jedis for failover using the `MultiClusterPooledConnectionProvider`, each call to Redis is decorated with a resilience4j retry and circuit breaker.
106
+
Once you configure Jedis for failover using the `MultiDbConnectionProvider`, each call to Redis is decorated with a resilience4j retry and circuit breaker.
102
107
103
108
By default, any call that throws a `JedisConnectionException` will be retried up to 3 times.
104
109
If the call fail then the circuit breaker will record a failure.
105
110
106
111
The circuit breaker maintains a record of failures in a sliding window data structure.
107
-
If the failure rate reaches a configured threshold (e.g., when 50% of the last 10 calls have failed),
112
+
If the failure rate reaches a configured threshold (e.g., when 50% of the last 1000 calls have failed),
108
113
then the circuit breaker's state transitions from `CLOSED` to `OPEN`.
109
114
When this occurs, Jedis will attempt to connect to the next Redis database with the highest weight in its client configuration list.
110
115
111
116
The supported retry and circuit breaker settings, and their default values, are described below.
112
-
You can configure any of these settings using the `MultiClusterClientConfig.Builder` builder.
117
+
You can configure any of these settings using the `MultiDbConfig.Builder` builder.
113
118
Refer the basic usage above for an example of this.
114
119
115
120
### Retry configuration
116
-
121
+
Configuration for command retry behavior is encapsulated in `MultiDbConfig.RetryConfig`.
117
122
Jedis uses the following retry settings:
118
123
119
124
| Setting | Default value | Description |
@@ -124,10 +129,11 @@ Jedis uses the following retry settings:
124
129
| Retry included exception list |[JedisConnectionException]| A list of Throwable classes that count as failures and should be retried. |
125
130
| Retry ignored exception list | null | A list of Throwable classes to explicitly ignore for the purposes of retry. |
126
131
127
-
To disable retry, set `maxRetryAttempts` to 1.
132
+
To disable retry, set `maxAttempts` to 1.
128
133
129
134
### Circuit breaker configuration
130
-
135
+
For failover, Jedis uses a circuit breaker to detect when a Redis database has failed.
136
+
Failover configuration is encapsulated in `MultiDbConfig.CircuitBreakerConfig` and can be provided using the `MultiDbConfig.Builder.failureDetector()`.
131
137
Jedis uses the following circuit breaker settings:
132
138
133
139
| Setting | Default value | Description |
@@ -221,23 +227,23 @@ Use the `healthCheckStrategySupplier()` method to provide a custom health check
0 commit comments