RamenDR / ramen

Apache License 2.0
72 stars 52 forks source link

Caching Rook addons resources #1353

Closed abhijeet219 closed 3 months ago

abhijeet219 commented 4 months ago

Currently the addons fetch kustomization resources whenever they are started. This change will start using cache for those resources, so starting an addon can directly use the cached resources.

Changes:

Example demonstrating how the cache works:

Fetching of resources for envs/regional-dr.yaml:

$ drenv fetch envs/regional-dr.yaml -v
2024-05-02 01:47:48,116 INFO    [rdr] Fetching
2024-05-02 01:47:48,118 DEBUG   [main] Add executor fetch
2024-05-02 01:47:48,119 INFO    [rdr] Running addons/rook-operator/fetch
2024-05-02 01:47:48,127 INFO    [rdr] Running addons/rook-toolbox/fetch
2024-05-02 01:47:48,127 INFO    [rdr] Running addons/rook-cluster/fetch
2024-05-02 01:47:48,137 INFO    [rdr] Running addons/ocm-controller/fetch
2024-05-02 01:47:48,217 DEBUG   [rdr] Fetching /home/abshakya/.cache/drenv/addons/rook-operator.yaml
2024-05-02 01:47:48,237 DEBUG   [rdr] Fetching /home/abshakya/.cache/drenv/addons/rook-cluster.yaml
2024-05-02 01:47:48,240 DEBUG   [rdr] Fetching /home/abshakya/.cache/drenv/addons/ocm-controller.yaml
2024-05-02 01:47:48,243 DEBUG   [rdr] Fetching /home/abshakya/.cache/drenv/addons/rook-toolbox.yaml
2024-05-02 01:47:48,401 INFO    [rdr] addons/rook-toolbox/fetch completed in 0.27 seconds
2024-05-02 01:47:48,417 INFO    [rdr] addons/rook-cluster/fetch completed in 0.29 seconds
2024-05-02 01:47:49,738 INFO    [rdr] addons/rook-operator/fetch completed in 1.62 seconds
2024-05-02 01:48:20,869 INFO    [rdr] addons/ocm-controller/fetch completed in 32.73 seconds
2024-05-02 01:48:20,870 INFO    [rdr] Fetching finishied in 32.75 seconds
2024-05-02 01:48:20,871 DEBUG   [main] Starting shutdown
2024-05-02 01:48:20,871 DEBUG   [main] Shutting down executor fetch
2024-05-02 01:48:20,871 DEBUG   [main] Terminating process group 126967

Fetching resources may take different amount of time for different runs. And once fetched, addons can directly use these resources to get started, saving time and escaping the flaky network situation.

nirs commented 3 months ago

@abhijeet219 Also update the pr message:

nirs commented 3 months ago

Tested using #1359

abhijeet219 commented 3 months ago

@abhijeet219 Also update the pr message:

  • Reference to Configure rbd-mirror debug logs dynamically #1346 is not relevant now
  • When you show running the adding with and without caching, it is not clear if the addon was run on a started environment, and most of the time is spent on fetching the resources. Please make it more clear what is tested.
  • Showing only drenv fetch ... run will make this much more clear, since we measure only the time to get fetch the resources, and it is also logged in detail if using -v.

Added and explained drenv fetch ... in the PR message Should I remove the starting an addon part from the PR message, it is also making the PR message look very long.

nirs commented 3 months ago

Added and explained drenv fetch ... in the PR message Should I remove the starting an addon part from the PR message, it is also making the PR message look very long.

@abhijeet219 yes, the current example are long and not clear and better remove. Describing how fetch works is not needed in this PR - it was needed only in the PR introducing the cache.