Memory snapshots: Checkpoint/restore for sub-second startup
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.
Related posts
- GPU Memory Snapshots: Supercharging sub-second startup
Modal mediumAdept
Modal's GPU memory snapshots extend its gVisor-based checkpoint/restore to capture GPU state, using NVIDIA's new CUDA checkpoint API (driver branches 570/575) to lock CUDA processes, copy device memory, kernels, streams, contexts and memory mappings to host memory, then snapshot CPU and GPU state together. Restoring skips expensive warm-up such as torch.compile, CUDA graph capture and moving weights from CPU to GPU, which removes the earlier split between pre- and post-restore setup methods. Reported cold starts drop by up to 10x, for example Parakeet from about 20s to 2s, vLLM with Qwen2.5-0.5B from 45s to 5s, and a compiled ViT from 8.5s to 2.25s. The feature is in alpha and is enabled with an experimental flag.
- 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.
- Modal becomes a gVisor maintainer
Modal mediumAdept
Google is donating gVisor to the CNCF under maintainer-led governance, and Modal, which launches over 40 million gVisor containers a day for GPU inference, training, and AI sandboxes, is joining as a maintainer. gVisor's Go-based Sentry application kernel implements the Linux syscall interface and is itself confined by namespaces, cgroups and seccomp, giving tenant isolation without hardware virtualization: about 25 ms boot and 12 MB overhead. Modal's upstream work includes nvproxy support for new NVIDIA GPUs, NVLink, MPS and GPUDirect RDMA, plus a new rdmaproxy that reaches ~99% of native NCCL all-reduce bandwidth over InfiniBand, RoCE and EFA. Other contributions are huge-page recycling that lifts PyTorch shared-memory throughput from 2.9 to 22 GB/s and tmpfs work that makes SQLite 2.7x faster. Planned work covers multi-GPU memory snapshots, GPUDirect Storage, MIG/vGPU and sub-minute inference server startup.
- Inside Modal Notebooks: How we built a cloud GPU notebook that boots in seconds
Modal mediumAdept
Modal Notebooks runs Jupyter kernels inside Modal Sandboxes, using a `modal-kernelshim` daemon that translates ZeroMQ kernel protocol messages into HTTP tunneled through the control plane. Fast GPU boots come from a Rust FUSE lazy-loading container filesystem with a content-addressed tiered cache (page cache, SSD, zonal cache, regional CDN, blob storage). Supporting pieces include shared scheduling with idle-kernel pausing and VolumeFS (file trees in Spanner, eventually consistent ops) for persistent storage. Collaboration uses operational transformation via Rushlight over Redis Streams, with large outputs offloaded to S3 Express One Zone, and the editor adds LSP via Pyright, Ruff formatting compiled to WebAssembly, and AI next-edit suggestions.
- How to catch crypto miners using syscall signatures
Modal mediumAdept
Modal detects cryptominers abusing its GPU serverless platform by analyzing container syscalls at runtime rather than relying only on user metadata, which abusers can fake with stolen credit cards. Source and binary analysis and image scanning are ruled out because containers run arbitrary x86 code fetched at runtime, and ptrace-based strace costs about 10µs per context switch, which can slow syscall-heavy programs by more than 100x. Instead, gVisor's sentry kernel already intercepts every syscall, so Modal streams its seccheck tracepoints over a Unix socket to a per-container Rust thread. That thread matches events such as non-Python execve calls against rules, kills flagged containers and feeds auto-banning, with zero false positives reported so far.