Skip to content
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

feat: Consistent hashing with bounded loads algorithm for sharding #16564

Conversation

akram
Copy link
Contributor

@akram akram commented Dec 7, 2023

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

@akram akram requested review from a team as code owners December 7, 2023 00:09
@akram akram changed the title Consistent sharding with bounded loads feat: Consistent sharding with bounded loads Dec 7, 2023
Copy link

codecov bot commented Dec 7, 2023

Codecov Report

Attention: Patch coverage is 51.06383% with 92 lines in your changes missing coverage. Please review.

Project coverage is 44.92%. Comparing base (69e82cc) to head (427bd5a).
Report is 1 commits behind head on master.

Files Patch % Lines
controller/sharding/consistent/consistent.go 38.46% 75 Missing and 5 partials ⚠️
controller/sharding/sharding.go 83.63% 6 Missing and 3 partials ⚠️
cmd/argocd/commands/admin/cluster.go 0.00% 2 Missing ⚠️
...ntroller/commands/argocd_application_controller.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #16564      +/-   ##
==========================================
+ Coverage   44.90%   44.92%   +0.02%     
==========================================
  Files         354      355       +1     
  Lines       47705    47889     +184     
==========================================
+ Hits        21421    21516      +95     
- Misses      23488    23569      +81     
- Partials     2796     2804       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch from 629cf2a to a2714e0 Compare December 7, 2023 00:59
@akram
Copy link
Contributor Author

akram commented Dec 7, 2023

Enhancement proposal is here #16570 and it has been exposed briefly during several calls, but, we will discuss more deeply

@akram akram marked this pull request as draft December 7, 2023 07:50
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch from a2714e0 to 5350c9c Compare December 11, 2023 13:46
@akram akram marked this pull request as ready for review December 11, 2023 13:48
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch 8 times, most recently from 9d86b5c to 08e7298 Compare January 17, 2024 14:17
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch 4 times, most recently from 5cf46ad to dfc7af1 Compare January 25, 2024 15:50
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch 2 times, most recently from e2d5bf7 to d143e9f Compare January 29, 2024 16:00
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch 2 times, most recently from 9b2ad1f to 20581cf Compare February 7, 2024 04:41
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch from 20581cf to ca5fadf Compare February 26, 2024 06:18
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch from ca5fadf to d20f4f3 Compare March 4, 2024 16:24
Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akram Last couple of things (mainly documentation), otherwise the PR looks good to merge!!

I think we missed adding "consistent-hashing" as a new option in cli commands in below places:

  1. command.Flags().StringVar(&shardingAlgorithm, "sharding-method", common.DefaultShardingAlgorithm, "Sharding method. Defaults: legacy. Supported sharding methods are : [legacy, round-robin] ")
  2. command.Flags().StringVar(&shardingAlgorithm, "sharding-method", common.DefaultShardingAlgorithm, "Sharding method. Defaults: legacy. Supported sharding methods are : [legacy, round-robin] ")
  3. command.Flags().StringVar(&shardingAlgorithm, "sharding-method", env.StringFromEnv(common.EnvControllerShardingAlgorithm, common.DefaultShardingAlgorithm), "Enables choice of sharding method. Supported sharding methods are : [legacy, round-robin] ")

Also, could you add some documentation regarding the feature in https://github.com/ishitasequeira/argo-cd/blob/f16b339bbfd17d93bdfe38c8f05cb7f4b4844123/docs/operator-manual/high_availability.md

@akram akram changed the title feat: Consistent sharding with bounded loads feat: Consistent hashing with bounded loads algorithm for sharding May 21, 2024
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch 2 times, most recently from e5ae056 to bb60944 Compare May 22, 2024 08:36
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch 3 times, most recently from aba8794 to c7d5f4f Compare May 30, 2024 15:09
@akram
Copy link
Contributor Author

akram commented May 30, 2024

@akram Last couple of things (mainly documentation), otherwise the PR looks good to merge!!

I think we missed adding "consistent-hashing" as a new option in cli commands in below places:

  1. command.Flags().StringVar(&shardingAlgorithm, "sharding-method", common.DefaultShardingAlgorithm, "Sharding method. Defaults: legacy. Supported sharding methods are : [legacy, round-robin] ")

done ✅

  1. command.Flags().StringVar(&shardingAlgorithm, "sharding-method", common.DefaultShardingAlgorithm, "Sharding method. Defaults: legacy. Supported sharding methods are : [legacy, round-robin] ")

done ✅

  1. command.Flags().StringVar(&shardingAlgorithm, "sharding-method", env.StringFromEnv(common.EnvControllerShardingAlgorithm, common.DefaultShardingAlgorithm), "Enables choice of sharding method. Supported sharding methods are : [legacy, round-robin] ")

done ✅

Also, could you add some documentation regarding the feature in https://github.com/ishitasequeira/argo-cd/blob/f16b339bbfd17d93bdfe38c8f05cb7f4b4844123/docs/operator-manual/high_availability.md

and done ✅

@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch from c7d5f4f to 41840e8 Compare June 3, 2024 09:47
Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akram there seems to be issues with the generated code. You would need to run codegen

@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch from 41840e8 to e617637 Compare June 3, 2024 14:28
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch 2 times, most recently from 0e0d564 to 2e5c3a9 Compare June 4, 2024 13:45
akram added 4 commits June 4, 2024 17:21
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
- The assignment or running of the algorithm has to be consistent across all the clusters. Changed the function to return a map where the consistent hash will be used to build the map

- Modifications to the createConsistentHashsingWithBoundLoads function. This will create the map for cluster to shard. Note that the list must be consistent across all shards so that is why the cluster list must be sorted before going through the consistent hash algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
@akram akram force-pushed the consistent-sharding-with-bounded-loads-akram branch from 2e5c3a9 to b349f81 Compare June 4, 2024 16:21
Copy link
Member

@ishitasequeira ishitasequeira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @akram !! LGTM!!

@ishitasequeira ishitasequeira enabled auto-merge (squash) June 5, 2024 02:30
@ishitasequeira ishitasequeira merged commit 75cd97d into argoproj:master Jun 5, 2024
28 checks passed
rumstead pushed a commit to rumstead/argo-cd that referenced this pull request Jun 6, 2024
…rgoproj#16564)

* Adds consistent hashing with bound loads sharding algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Make the assignement consistent accross all clusters
- The assignment or running of the algorithm has to be consistent across all the clusters. Changed the function to return a map where the consistent hash will be used to build the map

- Modifications to the createConsistentHashsingWithBoundLoads function. This will create the map for cluster to shard. Note that the list must be consistent across all shards so that is why the cluster list must be sorted before going through the consistent hash algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Extracting constant and simplifying boolean expression

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Update docs: consistent-hashing sharding algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

---------

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Signed-off-by: rumstead <37445536+rumstead@users.noreply.github.com>
timgriffiths pushed a commit to timgriffiths/argo-cd that referenced this pull request Jun 11, 2024
…rgoproj#16564)

* Adds consistent hashing with bound loads sharding algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Make the assignement consistent accross all clusters
- The assignment or running of the algorithm has to be consistent across all the clusters. Changed the function to return a map where the consistent hash will be used to build the map

- Modifications to the createConsistentHashsingWithBoundLoads function. This will create the map for cluster to shard. Note that the list must be consistent across all shards so that is why the cluster list must be sorted before going through the consistent hash algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Extracting constant and simplifying boolean expression

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Update docs: consistent-hashing sharding algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

---------

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
mkieweg pushed a commit to mkieweg/argo-cd that referenced this pull request Jun 11, 2024
…rgoproj#16564)

* Adds consistent hashing with bound loads sharding algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Make the assignement consistent accross all clusters
- The assignment or running of the algorithm has to be consistent across all the clusters. Changed the function to return a map where the consistent hash will be used to build the map

- Modifications to the createConsistentHashsingWithBoundLoads function. This will create the map for cluster to shard. Note that the list must be consistent across all shards so that is why the cluster list must be sorted before going through the consistent hash algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Extracting constant and simplifying boolean expression

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Update docs: consistent-hashing sharding algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

---------

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Hariharasuthan99 pushed a commit to AmadeusITGroup/argo-cd that referenced this pull request Jun 16, 2024
…rgoproj#16564)

* Adds consistent hashing with bound loads sharding algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Make the assignement consistent accross all clusters
- The assignment or running of the algorithm has to be consistent across all the clusters. Changed the function to return a map where the consistent hash will be used to build the map

- Modifications to the createConsistentHashsingWithBoundLoads function. This will create the map for cluster to shard. Note that the list must be consistent across all shards so that is why the cluster list must be sorted before going through the consistent hash algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Extracting constant and simplifying boolean expression

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

* Update docs: consistent-hashing sharding algorithm

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>

---------

Signed-off-by: Akram Ben Aissi <akram.benaissi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants