-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node: add AZ Affinity ReadFrom strategy Support #2686
Node: add AZ Affinity ReadFrom strategy Support #2686
Conversation
b2bd25d
to
512af5e
Compare
db6a4c7
to
06b0a1a
Compare
node/src/BaseClient.ts
Outdated
* | ||
* @example | ||
* ```typescript | ||
* configuration.client_az = 'us-east-1a'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this is the only type possible? should we restrict to one working standard or making sure we tell the user he was wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdym here? enforcing the client_az to be in a certain format? and if not, throw an error message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not throwing, loging.
Its more for the core level as its mutual, but the question is do we know what should be the right form and help the user more in order to not make mistakes.
Even on the level of saying known optional forms: AWS EC2 uses ... AWS EKS uses ... GCP uses ...
so at least its easy for him to validate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everyone has their own technical area and things can be confusing when you meet them first time.
Somebody might think its 1a
for example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accidentally deleted Yuri's comment here.
Some comments. |
06b0a1a
to
a6108e9
Compare
node/src/BaseClient.ts
Outdated
| "preferReplica" | ||
/** Spread the requests between replicas in the same client's AZ (Availability zone) in a round robin manner. | ||
If no replica is available, route the requests to the primary.*/ | ||
| "AZAffinity" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| "AZAffinity" | |
| { type: "AZAffinity", clientAz?: string; } |
That is more correct location of clientAz
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's possible that in the future we will want to support fully baked support for EC2, EKS and all the known and widely used platform. Meaning, the user will provide something else than clientAz
, and I'm afraid that putting those together will make issues later.
Try to think about the possible design and let me know if you don't think it will affect. IDK, the designs options doc is existing, but no decision has been taken, so I can speculate as you. I can share the doc if you want to dive into this question more deeply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sticked to the original, as when I updated it to what you're suggesting errors started appearing. LMK what you guys think
f045df9
to
5469747
Compare
00f12ef
to
ff525d7
Compare
Signed-off-by: Muhammad Awawdi <[email protected]> az NODE tests Signed-off-by: Muhammad Awawdi <[email protected]> CR fixes Signed-off-by: Muhammad Awawdi <[email protected]> CR change Signed-off-by: Muhammad Awawdi <[email protected]> Modified tests to dynamically pull the replicas number, and added more replicas to cluster config Signed-off-by: Muhammad Awawdi <[email protected]> updated number of replicas for the cluster, dropped the part for CMD as its irrelevant Signed-off-by: Muhammad Awawdi <[email protected]> prettier Signed-off-by: Muhammad Awawdi <[email protected]> Created a new cluster for AzAffinity in CME, and added Standalone tests for CMD Signed-off-by: Muhammad Awawdi <[email protected]>
ff525d7
to
ad8f145
Compare
Signed-off-by: Muhammad Awawdi <[email protected]>
Please add Change.log comment. see example - https://github.com/valkey-io/valkey-glide/pull/2676/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR2 |
node/src/BaseClient.ts
Outdated
@@ -574,6 +574,19 @@ export interface BaseClientConfiguration { | |||
* used. | |||
*/ | |||
inflightRequestsLimit?: number; | |||
/** | |||
* Availability Zone of the client. | |||
* This setting ensures that read operations are directed to nodes within the specified AZ. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- If ReadFrom strategy is AZAffinity, this setting ensures that readonly commands are directed to replicas within the specified AZ if exits.
getServerVersion, | ||
); | ||
|
||
azCluster = await ValkeyCluster.createCluster( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you can check the version before and to create it only for valkey 8 and above
!("value" in value) | ||
) | ||
return false; | ||
return value.value.includes(get_cmdstat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test will fail. The AZ strategy searching foe replica in the same az, if not exits it will other replica in round robin. so in this case every replica will run the get command once
Signed-off-by: Muhammad Awawdi <[email protected]>
Signed-off-by: Muhammad Awawdi <[email protected]>
Signed-off-by: Muhammad Awawdi <[email protected]>
Signed-off-by: Muhammad Awawdi <[email protected]>
Signed-off-by: Muhammad Awawdi <[email protected]>
Signed-off-by: Muhammad Awawdi <[email protected]>
* Added AZAffinity strategy to Node.js --------- Signed-off-by: Muhammad Awawdi <[email protected]>
* Added AZAffinity strategy to Node.js --------- Signed-off-by: Muhammad Awawdi <[email protected]>
Issue link
This Pull Request is linked to issue (URL): #643
Checklist
Before submitting the PR make sure the following are checked: