Problem with client caching when using AWS Elasticache redis

0

Hi,

we have a client application where we use a go rueidis library to connect to redis instances from our Kubernetes cluster.

we've successfully used the rueidis client to connect to our locally run redis test instances in the past and it works both with and without client caching activated. Now we've tried to get the same client code to connect with an Amazon ElastiCache Redis OSS instance (exact version being "ElastiCache (Redis OSS) version 7.1 (enhanced)"). I've found no documentation that Amazon ElastiCache redis doesn't support client-side caching in the AWS documentation but whenever we connect with the client caching activated we get the following error during initialization of the rueidis client. We have tried both an "ElastiCache (Redis OSS) Serverless" instance and an own ElastiCache (Redis OSS) cluster instance, but the error was the same in both cases:

Error during initialization: unknown subcommand 'tracking'. Try CLIENT HELP.: [CLIENT TRACKING ON OPTOUT] ClientOption.DisableCache must be true for redis not supporting client-side caching or not supporting RESP3"

We've also tried setting "AlwaysRESP2: true" on client-side and assuming that might be the problem, but it still results in the same error.

When disabling the client caching everything generally works, just of course without any client caching. Do you have any experience with this client libary or hints what the problem with getting the client side caching to work?

We have already asked the guys at rueidis, because we thought maybe there is a problem with the traffic going back from AWS to our kubernetes cluster when the "tracking" command is used, but according to them, the connection and inbound/outbound traffic for the "tracking" command should be the same as other commands as they share the same TCP connection and the client connection is successfully established at the time the error is returned. According to them the error was more likely returned by a Redis proxy which didn't support client-side caching, but we're not really sure what to make of this statement.

1 Answer
1

Client-side caching is not supported in ElastiCache Serverless, but it IS supported in self-managed ElastiCache deployments since Redis 6.

Now with that said, I tried to run the same command CLIENT TRACKING ON OPTOUT shown in your application error and associated commands directly on the cluster, I'm using an ElastiCache self-managed Redis 7.1 Cluster Mode enabled cluster and I was able to run them without any issues, feel free to try this out on your cluster while connecting through redis-cli from an accessible client -

cluster:6379> set mykey myvalue
OK

cluster:6379> get mykey
"myvalue"

cluster:6379> HELLO 3
1# "server" => "redis"
2# "version" => "7.1.0"
3# "proto" => (integer) 3
4# "id" => (integer) 109572
5# "mode" => "cluster"
6# "role" => "master"
7# "modules" => (empty array)

cluster:6379> CLIENT TRACKING ON OPTOUT
OK

cluster:6379> SET mykey newvalue
OK

cluster:6379> GET mykey
"newvalue"

cluster:6379> SET mykey newupdatedvalue
OK

cluster:6379> GET mykey
-> invalidate: 'mykey'
"newupdatedvalue"

cluster:6379> SET mykey changedvalue
OK

cluster:6379> GET mykey
-> invalidate: 'mykey'
"changedvalue"

As you can see above the OPTOUT option in client-side caching is working as expected when run directly on the cluster. (The OPTOUT option avoids the keys in the next command to be tracked, you can see invalidate messages for subsequent changes to the Key). I'm using HELLO 3 command here to enable RESP3 mode. It's unclear how these communications are done when performed through the Redis client rueidis, but feel free to test these commands directly on the cluster and see if your ElastiCache deployment is working as expected. If it does, I would recommend reaching out to the team responsible for rueidis client.

AWS
answered a month ago
profile picture
EXPERT
reviewed a month ago
profile picture
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions