Skip to content

Support different read mode in RedisHybridCacheClient#83

Merged
niemyjski merged 3 commits intoFoundatioFx:masterfrom
zinniawang149:feature/support_readmode_option_in_RedisHybridCacheClient
Mar 12, 2024
Merged

Support different read mode in RedisHybridCacheClient#83
niemyjski merged 3 commits intoFoundatioFx:masterfrom
zinniawang149:feature/support_readmode_option_in_RedisHybridCacheClient

Conversation

@zinniawang149
Copy link
Copy Markdown
Contributor

@zinniawang149 zinniawang149 commented Mar 11, 2024

At the moment, Even if we setup the Read mode in RedisHybridCacheClientOptions while creating the RedisHybridCacheClient instance, it doesn't work when we access the Redis.

The reason for that is because when we call the base object like this, we didn't pass the options.ReadMode in.

So the base readmode is always CommandFlags.None.

public CommandFlags ReadMode { get; set; } = CommandFlags.None;

Here is the example before/after the code update when we set the read mode as PreferReplica, the GetTypeCmds indicates the total number of read-only type commands. This is derived from the Redis commandstats statistic by summing all of the read-only type commands (get, hget, scard, lrange, and so on.):

The 001 nodes of both shards are the masters:
image

Before the code update, we can see all the read call still goes to the master node.
image

After the code update, the application starts fetching data from read replica.
image

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Zinnia Wang seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Zinnia Wang seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@zinniawang149
Copy link
Copy Markdown
Contributor Author

Have signed the Contributor License Agreement.

@niemyjski niemyjski merged commit 760c42a into FoundatioFx:master Mar 12, 2024
@niemyjski
Copy link
Copy Markdown
Member

Thanks for the PR! Also, those charts were awesome, would you mind sharing more on this (do you have a script that generates images automatically? I've been needing to look to see if there is a good way to do this with otel.):

the GetTypeCmds indicates the total number of read-only type commands. This is derived from the Redis commandstats statistic by summing all of the read-only type commands (get, hget, scard, lrange, and so on.):

@zinniawang149
Copy link
Copy Markdown
Contributor Author

@niemyjski
Thanks for accepting the change. The charts were actually screenshots I took from AWS CloudWatch metrics for Elasticache haha.

Also, wondering if you can release a new version? Because I need this change to improve the performance of our system.

@niemyjski
Copy link
Copy Markdown
Member

Please use a nightly feed (would be good to see if you see any other issues), I need to check to see what else we need to do before next release.

@zinniawang149 zinniawang149 deleted the feature/support_readmode_option_in_RedisHybridCacheClient branch March 12, 2024 23:46
@zinniawang149
Copy link
Copy Markdown
Contributor Author

@niemyjski I tried to run this cmd: dotnet add package Foundatio.Redis --version 10.7.1-alpha.0.1
https://github.com/FoundatioFx/Foundatio.Redis/pkgs/nuget/Foundatio.Redis/189858430
but got the error of Package 'Foundatio.Redis' is incompatible with 'all' frameworks in project
It looks to me like it is unable to find package Foundatio.Redis with version (>= 10.7.1-alpha.0.1) on Nuget

Can you see if it is working on your side?

@niemyjski
Copy link
Copy Markdown
Member

@zinniawang149
Copy link
Copy Markdown
Contributor Author

Right. It's working! Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants