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

[JUJU-485] Add per controller and per app limits for downloading resources #13650

Merged
merged 2 commits into from
Jan 25, 2022

Conversation

wallyworld
Copy link
Member

@wallyworld wallyworld commented Jan 25, 2022

This follows on from the work done in #13215 which throttled resource downloads from the store.
Here we introduce limits to resource downloads from the controller to the workload nodes (initiated by the unit agents calling resource-get).

There are 2 new controller config attributes:

  • controller-resource-download-limit
  • application-resource-download-limit

The first limits the number of total downloads for any app hosted in any model on the controller.
The latter limits the number of downloads per application per model.
The default values for these limits are 0, meaning no throttling; the new behaviour is opt in.

QA steps

I deployed the dummy-resource charm with slightly modified hooks; the line
status-set maintenance $(cat $RES_PATH)
was commented out.

First create a number of machines to run the charm
juju bootstrap
juju controller-config controller-resource-download-limit=5
juju add-machine -n 20

Optionally turn on debug logging for juju.resource.resourceadapters
juju model-config logging-config="juju.resource.resourceadapters=DEBUG"

Let the machines start.
watch -c juju status --color

Then deploy the charm twice with different app name, using a large zip file
juju deploy /path/to/dummy-resource -n 10 --resource dummy=./dummy-resource.zip --to 1,2,3,4,5,6,7,8,9,10
juju deploy /path/to/dummy-resource -n 10 app2 --resource dummy=./dummy-resource.zip --to 11,12,13,14,15,16,17,18,19,20

status will show the message for each unit change to indicate the resource is delivered. Typically a few change at once.
debug-log will show the resource download lock being acquired in batches.

ssh into the machines and check the zip file is present in the unit resources directory.

Bug reference

https://bugs.launchpad.net/juju/+bug/1940219

@wallyworld wallyworld changed the title Add per controller and per app limits for downloading resources [JUJU-485] Add per controller and per app limits for downloading resources Jan 25, 2022
@wallyworld wallyworld force-pushed the resource-download-limit branch from b7fa917 to a388a1f Compare January 25, 2022 04:35
Copy link
Member

@hpidcock hpidcock left a comment

Choose a reason for hiding this comment

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

LGTM just a few things

resource/repositories/operations_test.go Show resolved Hide resolved
resource/repositories/operations_test.go Outdated Show resolved Hide resolved
resource/resourceadapters/limiter.go Outdated Show resolved Hide resolved
resource/resourceadapters/limiter.go Outdated Show resolved Hide resolved
resource/resourceadapters/limiter_test.go Show resolved Hide resolved
resource/resourceadapters/limiter_test.go Show resolved Hide resolved
resource/resourceadapters/limiter_test.go Show resolved Hide resolved
@wallyworld
Copy link
Member Author

$$merge$$

@jujubot jujubot merged commit b9f202e into juju:2.9 Jan 25, 2022
@wallyworld wallyworld mentioned this pull request Jan 31, 2022
jujubot added a commit that referenced this pull request Feb 1, 2022
#13673

Merge 2.9

#13546 [JUJU-299] Store unit CharmURL as a string reference
#13640 add message query to juju wait-for
#13646 [JUJU-484] Stop polling external cmr controller when it is removed
#13634 [JUJU-463] Implement NetworkInterfaces method for azure provider
#13624 [JUJU-416] Consistantly use juju/retry to handle retries 3 (state/*)
#13648 [JUJU-464] Implement NetworkInterfaces method for openstack provider
#13636 [JUJU-479] Revert "unit charm url"
#13650 [JUJU-485] Add per controller and per app limits for downloading resources
#13649 [JUJU-481] Remove fake NIC generation fallback logic from instancepoller worker
#13681 Comment out the snap interfaces till approved
#13670 [JUJU-521] 1959351 fix slow juju ssh leader
#13671 [JUJU-527] Updating juju/os to support macos Monterey
#13678 [Juju-541] Document use of the @ symbol when setting a config value in help message

Lots of trivial conflicts due ot import path changes and the forward port of the charm download changes which first landed in this branch and were backported.

## QA steps

See PRs



[JUJU-299]: https://warthogs.atlassian.net/browse/JUJU-299?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-484]: https://warthogs.atlassian.net/browse/JUJU-484?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-463]: https://warthogs.atlassian.net/browse/JUJU-463?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-416]: https://warthogs.atlassian.net/browse/JUJU-416?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-464]: https://warthogs.atlassian.net/browse/JUJU-464?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-479]: https://warthogs.atlassian.net/browse/JUJU-479?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-485]: https://warthogs.atlassian.net/browse/JUJU-485?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-481]: https://warthogs.atlassian.net/browse/JUJU-481?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

[JUJU-521]: https://warthogs.atlassian.net/browse/JUJU-521?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
[JUJU-527]: https://warthogs.atlassian.net/browse/JUJU-527?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
@mengalong
Copy link

@wallyworld
recently i try to test this feature on juju-2.9.26,but found that Download concurrency cannot be limited

I want to know whether this patch really works?

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.

4 participants