* [Google Cloud Memorystore for Redis High availability](https://cloud.google.com/memorystore/docs/redis/high-availability)
* [Google Cloud Memorystore for Redis High availability](https://cloud.google.com/memorystore/docs/redis/high-availability)
@ -1701,6 +1707,8 @@ transportMode: "NIO"
## Proxy mode
## Proxy mode
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
Proxy mode supports single or multiple Redis or Valkey databases (including synced with active-active replication) used for read/write operations. Each Redis or Valkey hostname might be resolved to more than one IP address.
Proxy mode supports single or multiple Redis or Valkey databases (including synced with active-active replication) used for read/write operations. Each Redis or Valkey hostname might be resolved to more than one IP address.
Depending on value of [proxyMode](#proxy-mode) setting there are two modes:
Depending on value of [proxyMode](#proxy-mode) setting there are two modes:
@ -1717,8 +1725,6 @@ Compatible with:
* [Redis Enterprise Multiple Active Proxy](https://docs.redis.com/latest/rs/databases/configure/proxy-policy/#about-multiple-active-proxy-support)
* [Redis Enterprise Multiple Active Proxy](https://docs.redis.com/latest/rs/databases/configure/proxy-policy/#about-multiple-active-proxy-support)
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
Programmatic config example:
Programmatic config example:
```java
```java
Config config = new Config();
Config config = new Config();
@ -1981,15 +1987,15 @@ transportMode: "NIO"
## Multi cluster mode
## Multi cluster mode
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
Supports multiple Redis or Valkey Cluster setups with active-passive data replication relationship. Replication of the primary Cluster with secondary Redis Cluster is managed by `replicationMode` setting.
Supports multiple Redis or Valkey Cluster setups with active-passive data replication relationship. Replication of the primary Cluster with secondary Redis Cluster is managed by `replicationMode` setting.
Cluster with all available master nodes becomes the primary. Master nodes availability scan interval is defined by `scanInterval` setting.
Cluster with all available master nodes becomes the primary. Master nodes availability scan interval is defined by `scanInterval` setting.
Compatible with:
Compatible with:
* [AWS Redis Global Datastore](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html).
* [AWS Elasticache Global Datastore](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/Redis-Global-Datastore.html).
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
Programmatic config example:
Programmatic config example:
```java
```java
@ -2317,12 +2323,12 @@ transportMode: "NIO"
## Multi Sentinel mode
## Multi Sentinel mode
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
Supports multiple Redis or Valkey Sentinel setups with active-passive data replication.
Supports multiple Redis or Valkey Sentinel setups with active-passive data replication.
Replication of primary Sentinel deployment with secondary Sentinel deployments is managed by `replicationMode` setting. First sentinel host belongs to the active Sentinel setup and others to Passive Sentinel Setups.
Replication of primary Sentinel deployment with secondary Sentinel deployments is managed by `replicationMode` setting. First sentinel host belongs to the active Sentinel setup and others to Passive Sentinel Setups.
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
Although each Topic instance is cluster-compatible, it can be connected only to a single Redis or Valkey node which owns the topic name. That may cause the following issues:
* CPU overload on a single node.
* Overload of network or data traffic to a single node.
* Interruptions during failover.
Topic partitioning allows to resolve the issues above by connecting to each node and sharding messages between them. Partitions amount is defined through the global [topicSlots](../configuration.md) setting or per instance through `ClusteredTopicOptions.slots()` setting, which overrides the global setting.
long clientsReceivedMessage = topic.publish(new MyObject());
```
## Topic pattern
## Topic pattern
Java implementation of Redis or Valkey based [RPatternTopic](https://static.javadoc.io/org.redisson/redisson/latest/org/redisson/api/RPatternTopic.html) object. It allows to subscribe to multiple topics by specified glob-style pattern.
Java implementation of Redis or Valkey based [RPatternTopic](https://static.javadoc.io/org.redisson/redisson/latest/org/redisson/api/RPatternTopic.html) object. It allows to subscribe to multiple topics by specified glob-style pattern.
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
Although each ShardedTopic instance is cluster-compatible, it can be connected only to a single Redis or Valkey node which owns the topic name. That may cause the following issues:
* CPU overload on a single node.
* Overload of network or data traffic to a single node.
* Interruptions during failover.
ShardedTopic partitioning allows to resolve the issues above by connecting to each node and sharding messages between them. Partitions amount is defined through the global [topicSlots](../configuration.md) setting or per instance through `ClusteredTopicOptions.slots()` setting, which overrides the global setting.
long clientsReceivedMessage = topic.publish(new MyObject());
```
## Reliable Topic
## Reliable Topic
Java implementation of Redis or Valkey based [RReliableTopic](https://static.javadoc.io/org.redisson/redisson/latest/org/redisson/api/RReliableTopic.html) object implements Publish / Subscribe mechanism with reliable delivery of messages. In case of Redis or Valkey connection interruption all missed messages are delivered after reconnection to Redis. Message considered as delivered when it was received by Redisson and submited for processing by topic listeners.
Java implementation of Redis or Valkey based [RReliableTopic](https://static.javadoc.io/org.redisson/redisson/latest/org/redisson/api/RReliableTopic.html) object implements Publish / Subscribe mechanism with reliable delivery of messages. In case of Redis or Valkey connection interruption all missed messages are delivered after reconnection to Redis. Message considered as delivered when it was received by Redisson and submited for processing by topic listeners.
@ -259,4 +326,38 @@ Single<String> listenerRx = topic.addListener(SomeObject.class, new MessageListe
_This feature is available only in [Redisson PRO](https://redisson.pro) edition._
Although each ReliableTopic instance is cluster-compatible, it can be connected only to a single Redis or Valkey node which owns the topic name. That may cause the following issues:
* CPU overload on a single node.
* Overload of network or data traffic to a single node.
* Interruptions during failover.
ReliableTopic partitioning allows to resolve the issues above by connecting to each node and sharding messages between them. Partitions amount is defined through the global [topicSlots](../configuration.md) setting or per instance through `ClusteredTopicOptions.slots()` setting, which overrides the global setting.
1. All netty threads are busy, leading to delays in both Redis response decoding and sending commands to Redis.
1. All netty threads are busy, leading to delays in both response decoding and sending commands.
2. All connections are busy.
2. All connections are busy.
3. Redis server is busy and takes too long to respond the request.
3. Redis or Valkey server is busy and takes too long to respond the request.
4. Java application is busy.
4. Java application is busy.
5. Blocking invocation in async/reactive/rx listeners or subscribeOnElements methods.
5. Blocking invocation in async/reactive/rx listeners or subscribeOnElements methods.
6. Server CPU throttling. For GCP hosting try to add `--no-cpu-throttling` to CloudRun container which connects via Redisson to the Redis instance.
6. Server CPU throttling. For GCP hosting try to add `--no-cpu-throttling` to CloudRun container which connects via Redisson to the Redis or Valkey instance.
8. Redis or Valkey vendor limits concurrent connections amount.
First try to set follow values for `nettyThreads` setting: 32, 64, 128, 256 this allows Redisson to get a free netty thread to decode a response or send a command. Next, try to increase `retryInterval` and/or `timeout` to a reasonable value so that a command can still gracefully fail without having the end user wait forever. At the last step, try to increase `connection pool` setting so that Redisson can stand a better chance in getting a free connection.
First try to set follow values for `nettyThreads` setting: 32, 64, 128, 256 this allows Redisson to get a free netty thread to decode a response or send a command. Next, try to increase `retryInterval` and/or `timeout` to a reasonable value so that a command can still gracefully fail without having the end user wait forever. At the last step, try to increase `connection pool` setting so that Redisson can stand a better chance in getting a free connection.
Complex commands such as `keys`, `hmget` and big loops in Lua scripts are more likely to see it than other commands. It is important to understand an operation can still timeout despite the absence of it from the Redis slowlog. Slowlogs only record the time a command is been processed by the Redis event loop and not anything before or after. Network issue may also cause this exception when a response is still in-flight.
Complex commands such as `keys`, `hmget` and big loops in Lua scripts are more likely to see it than other commands. It is important to understand an operation can still timeout despite the absence of it from the Redis or Valkey slowlog. Slowlogs only record the time a command is been processed by the Redis or Valkey event loop and not anything before or after. Network issue may also cause this exception when a response is still in-flight.
**Q: When do I need to shut down a Redisson instance, at the end of each request or the end of the life of a thread?**
**Q: When do I need to shut down a Redisson instance, at the end of each request or the end of the life of a thread?**
**A** : Redisson instance requires manual shutdown only if you want to stop using all of its features. It is a common pattern that Redisson starts and stops along with the application. Since it is completely thread safe, you may treat a Redisson instance as a singleton. The shutdown sequence will disconnect all the active connections held in each connection pool, and it will clean up certain types of Redisson objects require a manual destroy action upon disposal, it will then stop the event loops. Please be advised, the entire shutdown process is not instant.
**A** : Redisson instance requires manual shutdown only if you want to stop using all of its features. It is a common pattern that Redisson starts and stops along with the application. Since it is completely thread safe, you may treat a Redisson instance as a singleton. The shutdown sequence will disconnect all the active connections held in each connection pool, and it will clean up certain types of Redisson objects require a manual destroy action upon disposal, it will then stop the event loops. Please be advised, the entire shutdown process is not instant.
**Q: In MapCache/SetCache/SpringCache/JCache, I have set an expiry time to an entry, why is it still in Redis when it should be disappeared?**
**Q: In MapCache/SetCache/SpringCache/JCache, I have set an expiry time to an entry, why is it still in Redis or Valkey when it should be disappeared?**
**A** : The first and foremost thing you need to understand is entry expiry feature is not supported by Redis. This is one of Redisson’s own creation. Which means it requires Redisson to work. You can’t expect a correct behaviour using other clients such as redis-cli or even jedis.
**A** : The first and foremost thing you need to understand is entry expiry feature is not supported by Redis or Valkey. This is one of Redisson’s own creation. Which means it requires Redisson to work. You can’t expect a correct behaviour using other clients such as redis-cli or even jedis.
Redisson employs both active approach and passive approach, just like Redis server, to ensure an element is evicted when its time is due. There is are scheduled eviction tasks that runs periodically to remove the expired elements from the collection, Redisson also checks the expiry information when an element is accessed: if it has expired, it will be removed and a null value will be returned.
Redisson employs both active approach and passive approach, just like Redis or Valkey server, to ensure an element is evicted when its time is due. There is are scheduled eviction tasks that runs periodically to remove the expired elements from the collection, Redisson also checks the expiry information when an element is accessed: if it has expired, it will be removed and a null value will be returned.
So if you saw the stale value in redis-cli, please do not panic, it will be removed when the scheduled task catches up or when you next request it through Redisson.
So if you saw the stale value in redis-cli, please do not panic, it will be removed when the scheduled task catches up or when you next request it through Redisson.
Integrates Redisson with Spring Data Redis library. Implements Spring Data's `RedisConnectionFactory` and `ReactiveRedisConnectionFactory` interfaces and allows to interact with Redis or Valkey through `RedisTemplate` or `ReactiveRedisTemplate` object.
Integrates Redisson with Spring Data Redis library. Implements Spring Data's `RedisConnectionFactory` and `ReactiveRedisConnectionFactory` interfaces and allows to interact with Redis or Valkey through `RedisTemplate`, `ReactiveRedisTemplate` or `ReactiveRedisOperations` object.
### Usage
### Usage
1. Add `redisson-spring-data` dependency into your project:
1. Add `redisson-spring-data` dependency into your project: