Skip to content

perf(runner): VM startup optimization plan - reduce from 20-25s to 3-5s #1167

@lancy

Description

@lancy

Overview

This is the tracking issue for the Firecracker VM startup optimization effort. The goal is to reduce VM startup time from 20-25 seconds to 3-5 seconds.

Current State

Phase Time Bottleneck Level
Rootfs copy (2GB) ~12s 🔴 Critical
Network setup ~0.5s 🟢 Low
Firecracker spawn ~0.2s 🟢 Low
VM boot (kernel + systemd) ~5-8s 🟡 Medium
SSH readiness ~3-5s 🟡 Medium
Post-boot setup ~1-2s 🟢 Low
Total 20-25s

Target State

Phase Current Target Optimization
Rootfs copy 12s 0.003s BTRFS reflink
VM boot 5-8s 1-2s Minimal init
SSH readiness 3-5s <1s Vsock
Total 20-25s 3-5s

Optimization Tasks

Phase 0: Foundation (Dev Mode)

Phase 1: High Impact (~12s savings)

Phase 2: Boot Optimization (~3-5s savings)

POC Validation Results

Tested on target machine (35.87.132.135 - ARM64, 16 CPU, 31GB RAM, gp3):

Test Result
gp3 write speed 174 MB/s
EXT4 reflink ❌ Not supported
BTRFS reflink (2GB) 0.003s
RAM disk speed 1.1 GB/s
KVM support ✅ Available

Success Metrics

Metric Current Target Status
VM startup time 20-25s <5s 🔄 In Progress
Rootfs copy time 12s <0.1s 🔄 Pending
SSH ready time 3-5s <1s 🔄 Pending

Recommended Order

  1. feat(runner): add benchmark command for VM performance testing #1165 Dev Mode - Enables testing and benchmarking for other optimizations
  2. perf(runner): implement BTRFS reflink for instant rootfs copy #1162 BTRFS - Highest impact, well-validated approach
  3. perf(runner): replace systemd with minimal init for faster boot #1164 Minimal Init - Reduces boot overhead
  4. perf(runner): implement vsock for host-guest communication #1163 Vsock - Most complex, do last

References

  • Research document: /tmp/deep-dive/runner-perf-optimization/research.md
  • Innovation document: /tmp/deep-dive/runner-perf-optimization/innovate.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions