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
AMR: use RESP3 and disable the default config channel by default (#3067)
* AMR: use RESP3 and disable the default config channel by default
* release notes
* support TLS (self-signed) in the test server, use for the AMR test
* don't do the AMR post-connection callback
* fix test break in Issue883 due to lazy provider lookup
* improved release notes
* verify config override works as expected
* spin up pub/sub on demand (or if pub/sub is active)
* build warning cleanup
* logging
* breakfix
* format
* AMR test for RESP2
<ItemGroupCondition="'$(MSBuildProjectName)' != 'Build' and '$(MSBuildProjectName)' != 'StackExchange.Redis.Build'">
46
+
<ItemGroupCondition="'$(MSBuildProjectName)' != 'Build' and '$(MSBuildProjectName)' != 'StackExchange.Redis.Build' and '$(MSBuildProjectName)' != 'docker' and '$(MSBuildProjectName)' != 'docs' and '$(MSBuildProjectName)' != '.github'">
47
47
<!-- for everything except the build-tools project itself and the Build.csproj wrapper: use the build project as an analyzer -->
Copy file name to clipboardExpand all lines: docs/ReleaseNotes.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,17 +8,17 @@ Current package versions:
8
8
9
9
## Unreleased
10
10
11
-
-(none)
11
+
-Prefer RESP3 and avoid opening a separate subscription connection for Azure Managed Redis endpoints ([#3067 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3067))
12
12
13
13
## 2.12.27
14
14
15
+
- Recognize Azure Managed Redis (AMR) resources in new Azure clouds ([#3068 by @philon-msft](https://github.com/StackExchange/StackExchange.Redis/pull/3068))
15
16
- Remove `[Experimental]` 8.8 `GCRA` feature ([#3074 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3074))
16
17
- Detect server-mode correctly on Valkey 8+ instances ([#3050 by @wipiano](https://github.com/StackExchange/StackExchange.Redis/pull/3050))
- Add experimental `Aggregate.Count` support for sorted-set combination operations against Redis 8.8 ([#3059 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3059))
19
-
- Support sub-key (hash field) notifications ([#3062 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3062))
20
+
- Support Redis 8.8 sub-key (hash field) notifications ([#3062 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3062))
20
21
- Add `ValueCondition` overloads for `SortedSetIncrement`/`SortedSetIncrementAsync`, supporting `ZADD INCR` with existence conditions ([#3071 by @mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/3071))
21
-
- Recognize Azure Managed Redis (AMR) resources in new Azure clouds ([#3068 by @philon-msft](https://github.com/StackExchange/StackExchange.Redis/pull/3068))
Copy file name to clipboardExpand all lines: docs/Resp3.md
+67-19Lines changed: 67 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,35 +2,80 @@
2
2
3
3
RESP2 and RESP3 are evolutions of the Redis protocol, with RESP3 existing from Redis server version 6 onwards (v7.2+ for Redis Enterprise). The main differences are:
4
4
5
-
1. RESP3 can carry out-of-band / "push" messages on a single connection, where-as RESP2 requires a separate connection for these messages
6
-
2. RESP3 can (when appropriate) convey additional semantic meaning about returned payloads inside the same result structure
7
-
3. Some commands (see [this topic](https://github.com/redis/redis-doc/issues/2511)) return different result structures in RESP3 mode; for example a flat interleaved array might become a jagged array
5
+
1. RESP3 can carry out-of-band / "push" messages on a single connection, where-as RESP2 requires a separate connection for out-of-band (pub/sub) messages
6
+
- this single connection can be of huge benefit in high-usage servers, as it halves the number of connections required
7
+
2. RESP3 supports *additional* out-of-band messages that cannot be expressed in RESP2, which allows advanced features such as "smart client handoffs" (a family of
8
+
server maintenance notifications)
9
+
- these features (not yet implemented in SE.Redis) allow for greater stability in complex deployments
10
+
3. RESP3 can (when appropriate) convey additional semantic meaning about returned payloads inside the same result structure
11
+
- this is *mostly* relevant to client libraries that do not explicitly interpret the results before exposing to the user, so this does not directly impact SE.Redis itself,
12
+
but it is relevant to consumers of SE.Redis that use Lua scripts or ad-hoc commands
8
13
9
-
For most people, #1is the main reason to consider RESP3, as in high-usage servers - this can halve the number of connections required.
10
-
This is particularly useful in hosted environments where the number of inbound connections to the server is capped as part of a service plan.
11
-
Alternatively, where users are currently choosing to disable the out-of-band connection to achieve this, they may now be able to re-enable this
12
-
(for example, to receive server maintenance notifications) *without* incurring any additional connection overhead.
14
+
For many users, using RESP3 is a "no-brainer" - it offers significant benefits with no real downsides. However, there are some important things to be aware of, and some
15
+
migration work that may be required. In particular, some commands *return different result structures* in RESP3 mode; for example a jagged (nested) array might become a "map"
16
+
(essentially an interleaved flat array). SE.Redis has been updated to handle these cases transparently, but if you are using `Execute[Async]` or `ScriptEvaluate[Async]` (or if
17
+
you are using an additional library that issues ad-hoc commands or scripts on your behalf) you may need to update your processing code to compensate for this. This is discussed more below.
13
18
14
-
Because of the significance of #3 (and to avoid breaking your code), the library does not currently default to RESP3 mode. This must be enabled explicitly
15
-
via `ConfigurationOptions.Protocol` or by adding `,protocol=resp3` (or `,protocol=3`) to the configuration string.
19
+
# Enabling RESP3
16
20
17
-
---
21
+
RESP2 and RESP3 are both supported options (if the server does not support RESP3, RESP2 will always be used). To make full use of the benefits of RESP3,
22
+
the library is moving in the direction of *preferring* RESP3. The default behaviour is:
18
23
19
-
#3 is a critical one - the library *should* already handle all documented commands that have revised results in RESP3, but if you're using
20
-
`Execute[Async]` to issue ad-hoc commands, you may need to update your processing code to compensate for this, ideally using detection to handle
21
-
*either* format so that the same code works in both REP2 and RESP3. Since the impacted commands are handled internally by the library, in reality
You can use this configuration to *explicitly enable* RESP3 on earlier library versions, or to *explicitly disable* RESP3 on later versions, if you encounter issues.
49
+
50
+
# Handling RESP3
51
+
52
+
For most users, *no additional work will be required*, or the additional work may be limited to updating libraries; for example, For example, [NRedisStack](https://www.nuget.org/packages/NRedisStack/)
53
+
now fully supports RESP3 for the commands it exposes (search, json, time-series, etc).
54
+
55
+
Scenarios impacted by RESP3 include:
25
56
26
57
- Lua scripts invoked via the `ScriptEvaluate[Async](...)` or related APIs, that either:
27
58
- Uses the `redis.setresp(3)` API and returns a value from `redis.[p]call(...)`
28
59
- Returns a value that satisfies the [LUA to RESP3 type conversion rules](https://redis.io/docs/manual/programmability/lua-api/#lua-to-resp3-type-conversion)
29
-
- Ad-hoc commands (in particular: *modules*) that are invoked via the `Execute[Async](string command, ...)` API
60
+
- Ad-hoc commands that are invoked via the `Execute[Async](string command, ...)` API
61
+
62
+
This delta is *especially* pronounced for some of the "modules" in Redis, even those that now ship by default in OSS Redis, including:
63
+
- "search" (`FT.SEARCH`, `FT.AGGREGATE`, etc.)
64
+
- "time-series" (`TS.RANGE`, etc.)
65
+
- "json" (`JSON.NUMINCRBY`, etc.)
66
+
67
+
Note that NRedisStack wraps most of these common modules, and has been updated to understand RESP3; if you are using these modules via NRedisStack, you should update to the latest version; if
68
+
you are using these modules via ad-hoc commands, you may need to update your processing code to compensate for this, or consider using NRedisStack instead, which will handle the RESP3 conversion for you.
30
69
31
-
...both which return `RedisResult`. **If you are not using these APIs, you should not need to do anything additional.**
70
+
This leaves a small category of users who are currently using the `RedisResult` type directly (via `Execute[Async](...)` or `ScriptEvaluate[Async](...)`).
32
71
33
-
Historically, you could use the `RedisResult.Type` property to query the type of data returned (integer, string, etc). In particular:
72
+
## Impact on RedisResult
73
+
74
+
Firstly, note that it is possible that the *structure* of the data changes between RESP2 and RESP3; for example, a jagged array might become a map, or a single string value might become an array. You will
75
+
need to identify these changes (typically via integration tests) and update your code accordingly, ideally with detection code to handle *either* structure so that the same code works in both REP2 and RESP3.
76
+
77
+
This is usually combined by using the `RedisResult.Resp3Type` property to query the type of data returned (integer, string, etc). Historically, you could use the `RedisResult.Type` property to query the type of data returned (integer, string, etc).
78
+
With RESP3, this is extended:
34
79
35
80
- Two new properties are added: `RedisResult.Resp2Type` and `RedisResult.Resp3Type`
36
81
- The `Resp3Type` property exposes the new semantic data (when using RESP3) - for example, it can indicate that a value is a double-precision number, a boolean, a map, etc (types that did not historically exist)
@@ -42,4 +87,7 @@ Possible changes required due to RESP3:
42
87
43
88
1. To prevent build warnings, replace usage of `ResultType.MultiBulk` with `ResultType.Array`, and usage of `RedisResult.Type` with `RedisResult.Resp2Type`
44
89
2. If you wish to exploit the additional semantic data when enabling RESP3, use `RedisResult.Resp3Type` where appropriate
45
-
3. If you are enabling RESP3, you must verify whether the commands you are using can give different result shapes on RESP3 connections
90
+
3. If you are enabling RESP3, you must verify whether the commands you are using can give different result shapes on RESP3 connections
91
+
92
+
An example of the types of changes required may be seen in the [NRedisStack #471](https://github.com/redis/NRedisStack/pull/471) pull-request, which updates result processing for multiple modules
93
+
(and changes the integration tests to run on RESP2 and RESP3 separately).
0 commit comments