Skip to content

Commit fd349f4

Browse files
committed
Merge upstream PR redis#3342 (DOC-6527) into feature/docker-support
RS: Explained replication_oom_threshold_percent in A-A memory limits docs. Upstream commit: 4ac6b28
2 parents b99be64 + 4ac6b28 commit fd349f4

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

content/operate/rs/databases/active-active/planning.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,33 @@ It's also important to know Active-Active databases have a lower threshold for a
4848

4949
For more information on memory limits, see [Memory and performance]({{< relref "/operate/rs/databases/memory-performance/" >}}) or [Database memory limits]({{< relref "/operate/rs/databases/memory-performance/memory-limit.md" >}}).
5050

51+
### Replication OOM protection
52+
53+
When a shard in an Active-Active database reaches an out-of-memory (OOM) condition:
54+
55+
1. Replication between that shard and its peers stops immediately.
56+
57+
1. The syncer process sends commands to the affected shard to trigger garbage collection and free memory.
58+
59+
If the database has no [eviction policy]({{<relref "/operate/rs/databases/memory-performance/eviction-policy/">}}) and no keys with [expiration times (TTL)]({{<relref "/develop/using-commands/keyspace#key-expiration">}}), no memory can be freed, which can lead to persistent replication failure and data desynchronization.
60+
61+
To reduce this risk, Active-Active databases running Redis version 8.4 or later support a configurable memory buffer through the `replication_oom_threshold_percent` setting. This setting reserves a percentage of memory below `maxmemory` for internal replication operations.
62+
63+
The `replication_oom_threshold_percent` setting works as follows:
64+
65+
- If memory usage is below the threshold, all client writes proceed normally.
66+
67+
- If memory usage exceeds the threshold, Redis blocks external client write commands with an out-of-memory error, but internal replication and garbage collection continue in the reserved buffer.
68+
69+
- If memory reaches `maxmemory` despite the client block, the standard out-of-memory behavior applies to all operations, including replication.
70+
71+
`replication_oom_threshold_percent` defaults to `5`, which means 5% of `maxmemory` is reserved. To adjust the reserved percentage, use an [update database configuration]({{<relref "operate/rs/references/rest-api/requests/bdbs#put-bdbs">}}) REST API request:
72+
73+
```sh
74+
PUT https://<host>:<port>/v1/bdbs/<database_id>
75+
{ "replication_oom_threshold_percent": <integer from 0 to 20> }
76+
```
77+
5178
## Networking
5279
5380
Network requirements for Active-Active databases include:

content/operate/rs/databases/memory-performance/memory-limit.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,33 @@ but tries to avoid stopping primary shards.
6767
We recommend that you have a [monitoring platform]({{< relref "/operate/rs/monitoring/" >}}) that alerts you before a system gets low on RAM.
6868
You must maintain sufficient free memory to make sure that you have a healthy Redis Software installation.
6969

70+
### Active-Active replication OOM protection
71+
72+
When a shard in an Active-Active database reaches an out-of-memory (OOM) condition:
73+
74+
1. Replication between that shard and its peers stops immediately.
75+
76+
1. The syncer process sends commands to the affected shard to trigger garbage collection and free memory.
77+
78+
If the database has no [eviction policy]({{<relref "/operate/rs/databases/memory-performance/eviction-policy/">}}) and no keys with [expiration times (TTL)]({{<relref "/develop/using-commands/keyspace#key-expiration">}}), no memory can be freed, which can lead to persistent replication failure and data desynchronization.
79+
80+
To reduce this risk, Active-Active databases running Redis version 8.4 or later support a configurable memory buffer through the `replication_oom_threshold_percent` setting. This setting reserves a percentage of memory below `maxmemory` for internal replication operations.
81+
82+
The `replication_oom_threshold_percent` setting works as follows:
83+
84+
- If memory usage is below the threshold, all client writes proceed normally.
85+
86+
- If memory usage exceeds the threshold, Redis blocks external client write commands with an out-of-memory error, but internal replication and garbage collection continue in the reserved buffer.
87+
88+
- If memory reaches `maxmemory` despite the client block, the standard out-of-memory behavior applies to all operations, including replication.
89+
90+
`replication_oom_threshold_percent` defaults to `5`, which means 5% of `maxmemory` is reserved. To adjust the reserved percentage, use an [update database configuration]({{<relref "operate/rs/references/rest-api/requests/bdbs#put-bdbs">}}) REST API request:
91+
92+
```sh
93+
PUT https://<host>:<port>/v1/bdbs/<database_id>
94+
{ "replication_oom_threshold_percent": <integer from 0 to 20> }
95+
```
96+
7097
## Adaptive memory allocation
7198
7299
In rare cases during high-velocity data ingestion, databases can temporarily reach up to 200% of their configured memory limit. This adaptive memory allocation strategy allows large amounts of data to be written to the database quickly without rejecting valid transactions.

0 commit comments

Comments
 (0)