Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Replit 8 min read Case study mediumAdept

Speeding up Deployments with Lazy Image Streaming

Replit cut cold-boot times for large Deployment container images from 3-4 minutes to under 30 seconds by lazily streaming images through a FUSE filesystem instead of pulling and unpacking every layer up front. They compared the eStargz snapshotter, which requires converting images to a per-file-compressed seekable format with worse compression ratios, against AWS's SOCI snapshotter. SOCI stores separate zTOC metadata with gzip decompressor checkpoints, so existing OCI images can be range-fetched without modification, and Replit chose it. The main tradeoff is slower runtime filesystem access because every FUSE operation crosses between user space and kernel space several times.

Assumes: container image layersOverlayFS basicsgzip compression

Related posts

  • Memory snapshots: Checkpoint/restore for sub-second startup

    Modal mediumAdept

    Modal cuts serverless container cold starts roughly 2.5x by checkpointing a gVisor container's full process tree and filesystem mutations just before it accepts a request, then restoring it instead of re-running Python's syscall-heavy import path (import torch alone makes 26,000 syscalls through OverlayFS and a FUSE lazy-loading server). Restore speed depends mostly on getting the main process's memory pages into the page cache. gVisor loads pages in the background, prioritizing faulting pages, while the FUSE layer aggressively preloads the pages file. Snapshots are created on demand per worker because of CPU feature, NVIDIA driver and runtime compatibility. GPU state can't be saved, so models are loaded into CPU RAM before the snapshot and moved to the GPU after restore via snap=True/snap=False lifecycle hooks.

  • How we achieved truly serverless GPUs

    Modal mediumAdept

    Modal cuts GPU inference replica cold starts from roughly 2,000 seconds to about 50 seconds, a 40x speedup, by attacking each stage of spin-up. A solver-managed buffer of idle, health-checked GPUs, allocated with Google's GLOP linear program, takes instance provisioning out of the hot path. ImageFS, a libfuse filesystem, serves container images lazily from a tiered content-addressed cache, and CPU and CUDA checkpoint/restore skip host- and device-side initialization. The motivation is GPU Allocation Utilization: spiky inference demand leaves fixed allocations at 10-20% use, and fast autoscaling raises utilization and quality of service together.

  • Building fast filesystems for VMs

    Modal hardMaster

    Modal replaced virtio-fs with a custom virtio-blk backend, ImageFS-blk, for its VM Sandboxes. Under virtio-fs every metadata operation crosses the VM boundary: one chown cost three guest-to-host FUSE round trips and six host syscalls. ImageFS-blk synthesizes ext4 inode and extent metadata from lazily loaded image metadata, leaves file data sparse, and serves blocks on demand from a tiered cache. Writes go to a sparse file tracked by a dirty bitmap, giving block-level copy-on-write. Metadata operations now stay in the guest's ext4 journal (chown drops from ~99 µs to ~2.1 µs), bun install runs 12x faster (12.5s to 1.07s), and sub-second cold starts are preserved.

  • Litestream Writable VFS

    Fly.io mediumAdept

    Litestream's SQLite VFS now supports an optional write mode and background hydration, built so the Sprites storage stack can serve reads and writes milliseconds after a cold boot without first downloading its JuiceFS block map from object storage. Write mode assumes a single writer, disables polling for remote LTX files, and buffers writes locally, syncing them to S3 about every second. That gives 'eventual durability' that suits Sprites but probably not most applications. Hydration serves reads from object storage while pulling a compacted full copy of the database into a temporary local file, then switches reads to that file once it is ready. Ordinary workloads should keep running Litestream as a sidecar instead.

  • Xet is on the Hub

    Hugging Face mediumAdept

    Hugging Face migrated its first model and dataset repositories from Git LFS to Xet storage, which uses content-defined chunking (~64 KB chunks aggregated into ~64 MB blocks) so that only changed bytes are uploaded. The migration moved 4.5 TB and ~6% of Hub download traffic in one day and exposed two production issues. First, unaligned range requests from hf_transfer forced CAS to stream whole blocks, a 4:1 read amplification. Adding chunk-length metadata to the block format fixed this and cut GET latency ~35%. Second, unflushed page cache during uploads caused disk throttling and pod load imbalance, which was mitigated with per-pod concurrent upload limits. The core lesson is that incremental migrations of real traffic surface problems test environments can't.

The quest for software engineering knowledge.

Look:
Layout: