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: reduce redis traffic caused by app resource tree updates in redis #19722

Merged
merged 1 commit into from
Aug 29, 2024

Conversation

alexmt
Copy link
Collaborator

@alexmt alexmt commented Aug 29, 2024

PR reduces the amount of traffic sent from the controller to redis while updated application resource tree.

The application resource tree contains metadata of all resources that belongs to application and stored in redis. Currently, it replaces the whole resources tree in Redis every time any app resource changes. This causes exponential growth of traffic sent from the controller to Redis: the more resources the application has, the more frequently they change, and the more frequently the controller needs to update the resources tree, and the tree is bigger with each resource.

The PR allows to optionally split resources tree into shards using ARGOCD_APPLICATION_TREE_SHARD_SIZE env variable. If ARGOCD_APPLICATION_TREE_SHARD_SIZE is bigger then 0 then controller split app resources into shards and store each shard in a separate Redis key. When any app resource changes then only related shard is updated which significantly reduces amount of Redis traffic.

@alexmt alexmt requested a review from a team as a code owner August 29, 2024 03:44
Copy link

bunnyshell bot commented Aug 29, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

bunnyshell bot commented Aug 29, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link
Member

@wanghong230 wanghong230 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@gdsoumya gdsoumya left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@gdsoumya gdsoumya left a comment

Choose a reason for hiding this comment

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

Should we document this ARGOCD_APPLICATION_TREE_SHARD_SIZE ? in the deployment env or docs?

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 75.86207% with 14 lines in your changes missing coverage. Please review.

Please upload report for BASE (master@233a14b). Learn more about missing BASE report.
Report is 482 commits behind head on master.

Files with missing lines Patch % Lines
util/cache/appstate/cache.go 36.84% 8 Missing and 4 partials ⚠️
pkg/apis/application/v1alpha1/types.go 94.87% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #19722   +/-   ##
=========================================
  Coverage          ?   55.89%           
=========================================
  Files             ?      320           
  Lines             ?    44031           
  Branches          ?        0           
=========================================
  Hits              ?    24611           
  Misses            ?    16863           
  Partials          ?     2557           

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

@alexmt alexmt force-pushed the optimize-app-tree-traffic branch from 7d4ec8e to 91e2088 Compare August 29, 2024 16:25
@alexmt alexmt requested a review from a team as a code owner August 29, 2024 16:25
@alexmt
Copy link
Collaborator Author

alexmt commented Aug 29, 2024

@gdsoumya agree - updated the docs

@gdsoumya gdsoumya enabled auto-merge (squash) August 29, 2024 16:28
@gdsoumya gdsoumya merged commit 0acecad into argoproj:master Aug 29, 2024
26 of 28 checks passed
Copy link
Member

@christianh814 christianh814 left a comment

Choose a reason for hiding this comment

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

Thanks Alex!

eogns47 pushed a commit to eogns47/argo-cd that referenced this pull request Sep 2, 2024
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.

5 participants