Skip to content

Commit 8314d28

Browse files
authored
Merge pull request #1139 from redis/DOC-4745
RC: Redis hashing policy
2 parents 2b5cc55 + 5e71ef1 commit 8314d28

File tree

8 files changed

+80
-36
lines changed

8 files changed

+80
-36
lines changed

content/operate/rc/changelog/february-2025.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ categories:
77
- rc
88
description: New features, enhancements, and other changes added to Redis Cloud during
99
February 2025.
10-
highlights: Pico billing unit
10+
highlights: Pico billing unit, Redis hashing policy
1111
linktitle: February 2025
1212
weight: 36
1313
---

content/operate/rc/changelog/march-2025.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ categories:
77
- rc
88
description: New features, enhancements, and other changes added to Redis Cloud during
99
March 2025.
10-
highlights: Redis Insight on Redis Cloud
10+
highlights: Redis Insight on Redis Cloud, Redis Hashing policy
1111
linktitle: March 2025
1212
weight: 34
1313
---
@@ -18,4 +18,20 @@ weight: 34
1818

1919
Users with select Redis Cloud Essentials databases can now open a browser-based version of [Redis Insight]({{< relref "/operate/rc/databases/connect/insight-cloud" >}}) directly from Redis Cloud. See [Connect to your database]({{< relref "/operate/rc/databases/connect#ri-browser" >}}) to learn how to open Redis Insight from Redis Cloud.
2020

21-
This browser-based version of Redis Insight has a subset of the features of Redis Insight on desktop. For more information, see [Open with Redis Insight on Redis Cloud]({{< relref "/operate/rc/databases/connect/insight-cloud" >}}).
21+
This browser-based version of Redis Insight has a subset of the features of Redis Insight on desktop. For more information, see [Open with Redis Insight on Redis Cloud]({{< relref "/operate/rc/databases/connect/insight-cloud" >}}).
22+
23+
### Redis hashing policy
24+
25+
Accounts created after March 31, 2025, can select the new [Redis hashing policy]({{< relref "/operate/rc/databases/configuration/clustering#redis-hashing-policy" >}}) for their databases when creating a new database.
26+
27+
The Redis hashing policy is identical to the [hashing policy used by Redis Community Edition]({{< relref "/operate/oss_and_stack/reference/cluster-spec#hash-tags" >}}). This policy is recommended for most users. Select it if any of the following conditions apply:
28+
- This is your first Redis Cloud account, and you are starting fresh.
29+
- You are migrating data from Redis Community Edition or other Redis-managed platforms.
30+
- Your application does not use hashtags in database key names.
31+
- Your application uses binary data as key names.
32+
33+
See [Clustering]({{< relref "/operate/rc/databases/configuration/clustering#manage-the-hashing-policy" >}}) for more information.
34+
35+
## Deprecations
36+
37+
- The [Custom hashing policy]({{< relref "/operate/rc/databases/configuration/clustering#custom-hashing-policy" >}}) is no longer available for accounts created after March 31, 2025. For all other accounts, this policy is not recommended and will be deprecated in the future. Only select a custom hashing policy if you are already using a custom hashing policy with your existing Redis Cloud databases.

content/operate/rc/databases/configuration/clustering.md

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Redis server.
3838
An instance that belongs to a cluster can manage multiple hash
3939
slots. This division of the key space, known as _sharding_, is achieved by
4040
hashing the key names, or parts of these (key hash tags), in order to
41-
obtain the hash slot in which a key should reside.
41+
obtain the hash slot in which a key should reside. Redis Cloud supports several [hashing policies](#manage-the-hashing-policy).
4242

4343
Even when using multiple Redis processes, the use of a Redis
4444
Enterprise Cloud cluster is nearly transparent to the application that
@@ -86,46 +86,60 @@ are supported, with the following limitations:
8686
and pipelining are supported with Redis Cloud cluster
8787
like if it were a non-cluster DB.
8888

89-
## Manage the hashing policy
89+
## Hashing policies and hash tags {#manage-the-hashing-policy}
9090

91-
Redis defaults to the [standard hashing policy](#standard-hashing-policy).
92-
The clustering configuration of a Redis Cloud instance can be changed.
93-
However, hashing policy changes delete existing data
94-
(FLUSHDB) before they're applied.
91+
The hashing policy determines how data is distributed across multiple Redis processes of a database. It uses a hashing function to map keys to hash slots in these processes, ensuring an even distribution of data for optimal performance and scalability.
9592

96-
These changes include:
93+
The hashing function uses the entire key name to calculate the hash slot, unless the key name contains a **hash tag**, represented by a `{...}` pattern.
9794

98-
1. Changing the hashing policy, either from standard to custom or vice versa.
99-
1. Changing the order of custom hashing policy rules.
100-
1. Adding rules before existing ones in the custom hashing policy.
101-
1. Deleting rules from the custom hashing policy.
102-
1. Disabling clustering for the database.
95+
If the key contains a `{...}` pattern, only the substring between `{` and `}` is hashed in order to obtain the hash slot.
96+
97+
You can use the `{...}` pattern to direct related keys to the same hash slot, so that multi-key operations are supported on them. On the other hand, not using a hashtag in the key's name results in a (statistically) even distribution of keys across the keyspace's shards, which improves resource utilization. If your application does not perform multi-key operations, you don't need to construct key names with hashtags.
98+
99+
Redis Cloud offers 3 hashing policies, which differ in how hash tags are processed. These hashing policies are not always available.
100+
101+
For accounts created after March 31, 2025, Redis defaults to the [Redis hashing policy](#redis-hashing-policy) **when creating a new database**. For all other accounts, Redis defaults to the [standard hashing policy](#standard-hashing-policy).
102+
103+
### Redis hashing policy
104+
105+
{{< note >}}
106+
This policy is available for selected accounts and will be rolled out gradually to other accounts in the future.
107+
{{< /note >}}
108+
109+
The Redis hashing policy is identical to the [hashing policy used by Redis Community Edition]({{< relref "/operate/oss_and_stack/reference/cluster-spec#hash-tags" >}}). This policy is recommended for most users and you should select it if any of the following conditions apply:
110+
- This is your first Redis Cloud account, and you are starting fresh.
111+
- You are migrating data from Redis Community Edition or other Redis-managed platforms.
112+
- Your application does not use hashtags in database key names.
113+
- Your application uses binary data as key names.
103114

104115
### Standard hashing policy
105116

106-
When using the standard hashing policy, a Redis Cloud cluster
107-
behaves like a standard Redis cluster, and hashing is
108-
performed as follows:
109-
110-
1. Keys with a hashtag: a key's hashtag is any substring between '{'
111-
and '}' in the key's name. That means that when a key's name
112-
includes the pattern '{...}', the hashtag is used as input for the
113-
hashing function. For example, the following key names have the same
114-
hashtag and are mapped to the same slot: foo{bar},
115-
{bar}baz & foo{bar}baz.
116-
1. Keys without a hashtag: when a key doesn't contain the '{...}'
117-
pattern, the entire key's name is used for hashing.
118-
119-
You can use the '{...}' pattern to direct related keys to the same hash
120-
slot, so that multi-key operations are supported on them. On the other
121-
hand, not using a hashtag in the key's name results in a
122-
(statistically) even distribution of keys across the keyspace's shards,
123-
which improves resource utilization.
124-
If your application does not perform multi-key operations, you don't
125-
need to construct key names with hashtags.
117+
The Standard hashing policy is mostly consistent with the Redis hashing policy, and will generate the same hash-slot calculation in the following cases:
118+
1. Keys with a single hashtag: a key's hashtag is any substring between '{' and '}' in the key's name. That means that when a key's name includes the pattern '{...}', the hashtag is used as input for the hashing function. For example, the following key names have the same hashtag and are mapped to the same slot: foo{bar}, {bar}baz & foo{bar}baz.
119+
1. Keys without a hashtag: when a key doesn't contain the '{...}' pattern, the entire key's name is used for hashing
120+
121+
However, this policy is less recommended and you should select it only if any of the following conditions apply:
122+
- Your application uses empty hashtags to hash different keys to the same hashslot
123+
- Your application uses multiple curly brackets within a key’s name
124+
125+
In some cases, the Standard hashing policy behaves differently from the Redis hashing policy:
126+
1. Using empty hashtags (“{}”): the Standard hashing policy does not ignore empty hashtags, so two keys that start with empty hashtags will be hashed to the same hashslot (while the Redis hashing policy would ignore them).
127+
For example: given 2 keys {}foo and {}bar, hashing would be:
128+
- Standard hashing policy: to the same hash slot
129+
- Redis hashing policy: to different hash slots
130+
2. Using multiple curly brackets: when a key’s name contains multiple curly brackets, the Standard hashing calculation might be different than the Redis hashing policy.
131+
For example: given 2 keys {foo}bar} and {foo}qux}:
132+
- Standard hashing policy: substrings “foo}bar” and “foo}qux” will be used for the 1st and 2nd key respectively, hashed each key to a different hash-slot.
133+
- Redis hashing policy: the substring “foo” will be used for both keys, hashing them to the same slot.
126134

127135
### Custom hashing policy
128136

137+
{{< note >}}
138+
The custom hashing policy is not available for accounts created after March 31, 2025.
139+
140+
For all other accounts, this policy is not recommended and will be deprecated in the future. Select this option only if you are already using a custom hashing policy with your existing Redis Cloud databases.
141+
{{< /note >}}
142+
129143
A Redis Cloud cluster can be configured to use a custom hashing
130144
policy. A custom hashing policy is required when different keys need to
131145
be kept together on the same shard to allow multi-key operations. Redis
@@ -150,6 +164,19 @@ default RegEx rules that implement the standard hashing policy are:
150164
You can modify existing rules, add new ones, delete rules, or change
151165
their order to suit your application's requirements.
152166

167+
{{< warning >}}
168+
If the Custom hashing policy is available, you can change the hashing policy between Standard and Custom after you create your database. However, hashing policy changes delete existing data
169+
(using [`FLUSHDB`]({{< relref "/commands/flushdb" >}})) before they're applied.
170+
171+
These changes include:
172+
173+
1. Changing the hashing policy, either from standard to custom or vice versa.
174+
1. Changing the order of custom hashing policy rules.
175+
1. Adding rules before existing ones in the custom hashing policy.
176+
1. Deleting rules from the custom hashing policy.
177+
1. Disabling clustering for the database.
178+
{{< /warning >}}
179+
153180
### Custom hashing policy notes and limitations
154181

155182
1. You can define up to 32 RegEx rules, each up to 256 characters.

content/operate/rc/databases/create-database/create-pro-database-new.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ By default, you're shown basic settings, which include:
162162
| **Name** | A custom name for your database (_required_) |
163163
| **Dataset size (GB)** | The amount of data for your dataset. Specify small sizes as decimals of 1.0&nbsp;GB; example: `0.1` GB (minimum). We calculate the total memory limit for you based on the other settings you choose for your database. <br/> Databases with Search and query have specific sizing requirements, see [Search and query sizing]({{< relref "/operate/rc/databases/configuration/advanced-capabilities#search-and-query-sizing" >}}) for more information. |
164164
| **High Availability** | Indicates whether a replica copy of the database is maintained in case the primary database becomes unavailable. (Warning: Doubles memory consumption). See [High Availability]({{< relref "/operate/rc/databases/configuration/high-availability" >}}). |
165-
| **Throughput** | Identifies maximum throughput for the database, which is specified in terms of operations per second (**Ops/sec**). See [Throughput]({{< relref "/operate/rc/databases/configuration/clustering#throughput" >}}) for more information. <br/> Databases with Search and query have specific throughput requirements, see [Search and query sizing]({{< relref "/operate/rc/databases/configuration/advanced-capabilities#search-and-query-sizing" >}}) for more information. |
165+
| **Throughput** | Identifies maximum throughput for the database, which is specified in terms of operations per second (**Ops/sec**). See [Throughput]({{< relref "/operate/rc/databases/configuration/sizing#throughput" >}}) for more information. <br/> Databases with Search and query have specific throughput requirements. See [Search and query sizing]({{< relref "/operate/rc/databases/configuration/advanced-capabilities#search-and-query-sizing" >}}) for more information. |
166+
| **Hashing policy** | Determines how data is distributed across multiple Redis processes of a database. Available options depend on your account creation date. See [Clustering]({{< relref "/operate/rc/databases/configuration/clustering#manage-the-hashing-policy" >}}) for more information. |
166167
| **Query performance factor** | *(Search and query databases on Redis 7.2 or later only)* Adds additional compute power to process your query and vector search workloads and boost your queries per second. See [Search and query sizing]({{< relref "/operate/rc/databases/configuration/advanced-capabilities#search-and-query-sizing" >}}) for more information. |
167168
| **Data Persistence** | Defines the data persistence policy, if any. See [Data persistence]({{< relref "/operate/rc/databases/configuration/data-persistence.md" >}}). |
168169

Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)