nix collect-garbage
is kind of slow at deleting paths #418
Labels
No labels
Area/build-packaging
Area/evaluator
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#418
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I bet it's entirely single threaded. We should look into that.
Redesign idea that would avoid a lot of rearchitecture (since the current gc preserves invariants like that paths always have their dependencies): run the GC in two parts: one thread, which is exactly identical to the current GC except it replaces the recursive-delete operation with another which moves paths into a garbage bin, say,
/nix/store/.garbage
, and adds it to a deleter queue. Then the deleter queue is consumed by a thread pool that does not care about ordering.The deleter queue is also initially populated with the current contents of the
.garbage
directory in case it is interrupted.By doing it this way, we get:
Bit worried about the effect this will have on IOPs used, since iirc
nix-collect-garbage
can already consume a problematic amount on it's own and it's not necessarily easily tuned by end users.I suppose adding a config parameter for maximum paths removed in parallel may be enough, but it's worth some consideration first.
This shouldn't have a major effect in that regard — it's not parallelizing, just not blocking deletion by store paths being live from not having been deleted yet, and renames are cheap. But it's worth taking a look at before and after, yeah.
For anyone looking at this in the future, I have wip code for this here: https://git.lix.systems/jade/lix/src/branch/jade/fast-gc