Node: add AZ Affinity ReadFrom strategy Support#2686
Node: add AZ Affinity ReadFrom strategy Support#2686adarovadya merged 10 commits intovalkey-io:release-1.2from
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.
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.
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.
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.
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.
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.
| | "AZAffinity" | |
| | { type: "AZAffinity", clientAz?: string; } |
That is more correct location of clientAz.
There was a problem hiding this comment.
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.
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 <mawawdi@amazon.com> az NODE tests Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com> CR fixes Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com> CR change Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com> Modified tests to dynamically pull the replicas number, and added more replicas to cluster config Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com> updated number of replicas for the cluster, dropped the part for CMD as its irrelevant Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com> prettier Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com> Created a new cluster for AzAffinity in CME, and added Standalone tests for CMD Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
ff525d7 to
ad8f145
Compare
Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
|
Please add Change.log comment. see example - https://github.com/valkey-io/valkey-glide/pull/2676/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR2 |
node/src/BaseClient.ts
Outdated
| 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.
- 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.
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.
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 <mawawdi@amazon.com>
Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
* Added AZAffinity strategy to Node.js --------- Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
* Added AZAffinity strategy to Node.js --------- Signed-off-by: Muhammad Awawdi <mawawdi@amazon.com>
Issue link
This Pull Request is linked to issue (URL): #643
Checklist
Before submitting the PR make sure the following are checked: