feat: prototype RattlerFS integration#6548
Conversation
Add `experimental.environment-backend = "mount"`, which serves a pixi environment from a virtual filesystem (via the rattler_fs crate) instead of hardlinking packages into the prefix. A per-environment sidecar process (`pixi mount --managed`) owns the mount; `pixi run` / `pixi shell` coordinate its lifetime with an flock-based reference count plus a grace period, and `pixi umount` tears it down. Includes the mount/umount subcommands, the sidecar lifecycle module, the config options (environment-backend, mount-backend, mount-read-only, mount-grace-period, mount-overlay-mismatch, with matching PIXI_* env overrides), and the run/shell install-path interception (unix-only, inert unless the experimental flag is set). Windows/ProjFS support exists in rattler_fs but is deliberately not yet wired into run/shell. Guards the transitions so the two backends can't silently corrupt each other: refuses to mount over a physical (link-backend) install, and refuses to link-install into a live mount. When the lock file changes (e.g. `pixi add`) the environment is remounted transparently while idle, and errors with a clear message if it is currently in use by another `pixi shell` / `pixi run`. The persistent overlay may hold user writes (e.g. `pip install`); on an idle remount for a changed environment, `mount-overlay-mismatch` (error/warn/ignore, default warn) selects whether to refuse, adopt-with-warning, or adopt silently.
Point the [patch.crates-io] rattler entries at the chrisburr/rattler fork (branch feat/rattler-fs) via git instead of absolute local paths, so the workspace builds without a sibling rattler checkout (e.g. in CI).
|
This is really, really, really cool! I think it would be good to think through the UX implications of this design, especially in combination with source dependencies further before committing to this. Also the architectural implications of a sidecar process. However, I see a much more concrete use for this for ephemeral or throw-away-environments, like the ones created for |
Yeah! I'm biased but I think this is by far the coolest thing I've ever built 😅
Ah yes, I forgot about the rattler-build use case. It's been so long thinking about this now that I can't keep track of all of my ideas. I could also see it being useful for conda-forge for builds which use a lot of disk space. Not having the sidecare for Ah I just realised you might be thinking that |
|
Yeah I think a sidecar or long running service is definitely the way forward (not just for this, we have other usecases in pixi that would massively benefit from this) but also a pretty big architectural change. Therefore I think starting with purely ephemeral environments is a good first start. We can always extend/reuse/improve that later. I think we can also dive a bit deeper in making sure that the cold-start overhead is lower, I think there are lots of opportunities to improve concurrency in the implementation. |
Description
This builds upon conda/rattler#2566 to add support for RattlerFS. I've spent less time polishing this than the
rattler_fscrate so I haven't fully thought through the UX side of things but this prototype was useful for figuring out the correct API in rattler. In general this:PIXI_MOUNT_BACKEND/PIXI_MOUNT_READ_ONLY/PIXI_MOUNT_GRACE_PERIOD/PIXI_MOUNT_OVERLAY_MISMATCHpixi mountcommand to avoid the sidecar and manually control th mount and apixi umountto manually shutdown the sidecar.Performance
For benchmarking there are too many variables to really give a clear number but from the below example (which already had a hot cache in
~/.cache/rattler/) I have these results. Note I haven't particularly tried to optimise this and there are a ton of tricks that might help.Linux + FUSE
macOS + NFS
macOS has a very surprising performance:
Pre-compiled binary
As I have a few people interested in this I quickly hacked togther some CI for a rebranded pixi binary (
pixi-rattlerfs) which can used for trying this:Download the pre-compiled binary:
Create a fairly large environment:
Measure the time for first import with RattlerFS:
Second import with RattlerFS:
First import without RattlerFS:
Second import without RattlerFS:
How Has This Been Tested?
See above.
AI Disclosure
I'll quote my comment from conda/rattler#2566:
Checklist:
schema/model.py.