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

Periodically clean up cached bundles directory #5737

Open
kostko opened this issue Jul 3, 2024 · 4 comments
Open

Periodically clean up cached bundles directory #5737

kostko opened this issue Jul 3, 2024 · 4 comments
Assignees
Labels
c:performance Category: performance

Comments

@kostko
Copy link
Member

kostko commented Jul 3, 2024

Currently the cached exploded bundles are never removed which can result in a lot of disk use after a few upgrades. We should make it so that cached bundles are periodically removed if they are either:

  • For versions lower than the active runtime version (regular bundles).
  • From bundles that are no longer present in configuration (regular and detached bundles).
@kostko kostko added the c:performance Category: performance label Jul 3, 2024
@martintomazic
Copy link

There might be exception for the paratime clients (?):

For versions lower than the active runtime version (regular bundles).

Haven't checked this in the code yet, but (see excerpt from the docs; updating paratimes):

If you are running a client node, ParaTime state syncing will be performed regardless of the version installed.

@kostko
Copy link
Member Author

kostko commented Dec 6, 2024

That is related to syncing runtime transactions and state. Since we are using state diffs, there is no need to have the correct runtime version as the runtime logic itself is not involved during storage sync.

@martintomazic
Copy link

cached bundles are periodically removed

I was thinking about keeping it simple i.e.:

  • Single clean-up during/after newRuntimeConfig to handle stale exploded bundles no longer in the config.
  • For versions lower then the current active one, doing a clean-up where the actual hosted runtime version changes (see) and also remove it from the hostConfig of the corresponding runtime registry?
    • Am I complicating and should simply watch WatchActiveDescriptor instead?
    • I am worried this might be bad idea if the runtime lags slighlty behind the consensus, or is this actually not possible by design?

Will hopefully have draft PR ready tmr :)

@kostko
Copy link
Member Author

kostko commented Dec 16, 2024

Single clean-up during/after

I would just make sure that this doesn't block initialization so while it should be fired on startup, it should be done in the background.

I am worried this might be bad idea if the runtime lags slighlty behind the consensus

What do you mean? To determine the active runtime version you only need to look at consensus (the active descriptor you mentioned). Runtimes and consensus are always in sync currently and once a version is deemed the active version, it can never revert to a version with a lower version number. So even if the node is behind, once a version is active in the consensus layer, you know that no earlier versions can ever activate for that runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:performance Category: performance
Projects
None yet
Development

No branches or pull requests

2 participants