Repository navigation
Description
Split out from #147 (the build→attach path is now fully shipped: spawn snapshot create --from <dir|tar|tar.gz|raw> in v0.48.0 + --attach-volume in v0.46.0). FSR is the remaining piece and is filed separately because it has a recurring real-money cost, so it needs its own design + opt-in UX review rather than riding on a shipped feature.
Problem
A volume created from a snapshot lazy-loads blocks from S3 on first access. For a single instance that's fine, but for a wide fan-out (e.g. ~100 Kraken2 tasks each creating a volume from the same k2_pluspf snapshot via --attach-volume), every volume pays first-touch latency on the reference data. That's the one gap between the data-volume path and a baked-AMI's warm local disk.
What FSR does
Fast Snapshot Restore pre-warms a snapshot in specific AZs so every volume created from it is immediately at full performance — no first-read penalty. SDK ops already available: EnableFastSnapshotRestores, DisableFastSnapshotRestores, DescribeFastSnapshotRestores (verified in the EC2 SDK).
The catch — it bills per-AZ-hour
FSR costs ~$0.75 per snapshot per AZ per hour while enabled (regardless of use). So spawn must never silently enable it — it's a paid AWS feature toggled on the user's behalf. Design must make the cost explicit and bound the enabled window.
Proposed design (for review)
- Opt-in flag, never default:
spawn launch --attach-volume snap-xxx:/mnt:ro --fsrenables FSR for that snapshot in the launch AZ before creating the volume; or- a standalone
spawn snapshot warm <snap> --azs us-east-1a,us-east-1b [--disable]so the user owns the costly window explicitly.
- Cost confirmation in the launch/estimate flow, like the existing instance cost estimate — show $/AZ/hr and require
-yto proceed. - Bounded window / auto-disable: a run-scoped or TTL'd disable so FSR doesn't bill indefinitely after the fan-out drains (e.g.
--fsr-disable-on-drain, or the reaper disables it when the last consuming instance terminates — ties into the lifecycle invariant). - State enforcement: only enable when state can later be disabled; surface
DescribeFastSnapshotRestoresinspawn snapshot status.
Validation
- Unit: flag/cost-confirmation parsing; enable→describe→disable round-trip (substrate models EC2 control plane — confirm it serves the FSR ops; if not, file a gap and table-test the lifecycle logic).
- Live (paid, bounded, leak-check): enable FSR on a real snapshot in 1 AZ, confirm
optimizing→enabled, launch a couple of--attach-volumeinstances, disable FSR, verify it's disabled (no lingering per-AZ-hour charge), terminate + leak-check. FSR left enabled is itself a cost leak — the validation must prove disable.
Cross-refs
- Parent: Feature: build a reference-data EBS snapshot via EBS direct APIs + attach FSR-warmed volumes — get large reference data onto spores without baking AMIs #147 (build→attach, shipped). Consumer: nf-spawn#45 (
ext.volumes). - Cost-control is existential here: this is the one feature in the set that spends money continuously while on, so the bias is hard opt-in + guaranteed disable.
Activity