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

Garbage collection approaches #4

Closed
deemp opened this issue Jul 7, 2023 · 1 comment
Closed

Garbage collection approaches #4

deemp opened this issue Jul 7, 2023 · 1 comment

Comments

@deemp
Copy link
Collaborator

deemp commented Jul 7, 2023

Here's a discussion of garbage collection approaches.

Problem statement

When restoring a Nix store from a cache, the store may contain old unnecessary paths.
These paths should be removed sometimes to limit cache size and ensure the fastest restore/save steps.

Approach 1

Produce a cache once, use it multiple times. Don't collect garbage.

Advantages:

  • Unnecessary paths are saved to a cache only during a new save.

Disadvantages:

  • Unnecessary paths can accumulate between new saves.
    • A job at the firs run produces a path A and saves a cache.
    • The job at the second run restores the cache, produces a path B, and saves a cache. The cache has both A and B.
    • etc.

Approach 2

Collect garbage before saving a cache.

Advantages:

  • Automatically keep cache at a minimal/limited size

Disadvantages:

  • No standard way to gc only old paths.

Hopefully working solutions

@deemp deemp changed the title Smarter garbage collection Garbage collection Jul 8, 2023
@deemp deemp changed the title Garbage collection Garbage collection approaches Jul 17, 2023
@deemp
Copy link
Collaborator Author

deemp commented Aug 29, 2023

Moved to README in 3c9ac93

@deemp deemp closed this as completed Aug 29, 2023
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

No branches or pull requests

1 participant