Replies: 2 comments 4 replies
-
|
Hi @proost, Thank you for your proposal. It looks good generally, however, there are several things unclear:
BTW, in my opinion, client-side caching should be a better choice for read-heavy applications. Have you tried that? |
Beta Was this translation helpful? Give feedback.
4 replies
-
|
close: #402 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Adding Read-Write Splitting feature to cluster client to use Redis cluster more efficiently.
Problem Definition
Background
Someone who wants to use redis cluster more efficiently with rueidis, have to use two rueidis clients, that one is for primary and the other is replicas. Because rueidis doesn’t support Read-Write splitting.
Goal
Non-Goal
Plan
Read-Write Splitting configuration is defined in
ReadFromstruct. In this proposal, I defined onlyReplicasoption which client use replicas for read operations.ReadFromoption is defined asClientOptionfield so that user can configure Read-Write Splitting configuration.ReadFromcan’t work withReplicaOnlyoption. because a client can send a command to primary node. so constructor should return error whenReadFromis set &ReplicaOnlyis true.Cluster client should have read connection & write connection per slot. If a read command is given, use read connection to send command to a slot. If a write command is given, use write connection to send command to a slot.
readConnsPerSlot&writeConnsPerSlotare refreshed in a_refreshfunction.Do,DoMulti,DoCache,DoMultiCache,Receivehave to pick connection to send commands. AllCompletedtype commands hasIsReadOnlymethod. UsingIsReadOnlymethod,pickcan know whether command is read operation or not. sopickmethod changed like this.if
ReadFromis set, then choose read connection or write connection inpickmethod.Pipelining method, like
DoMulti, chooses each connection per command in_pickMultimethod or_pickMultiCacheCurrently
Cacheabletype doesn’t supportIsReadOnlymethod. So defineIsReadOnlymethod too.Beta Was this translation helpful? Give feedback.
All reactions