Container Live Migration
Seamless live migration of running containers across Spot hosts with zero process restarts and preserved TCP connections.
Why Live Migration Matters for Containers
In conventional container platforms (Kubernetes, Docker), the concept of Live Migration does not exist:
- When a node is drained for maintenance or reclaimed by a cloud provider during Spot eviction, Kubernetes issues a
SIGTERMsignal, terminates running pods (SIGKILL), and restarts them from scratch on a new server. - This triggers complete loss of in-memory state, drops all active client TCP connections (WebSockets, gRPC streaming, database connection pools), and clears local ephemeral storage.
In microsrv, containers benefit from full live migration parity with virtual machines (KVM).
[!NOTE] The container transitions to a new physical server without interrupting running code, resetting in-memory state, or dropping network connections.
Live Migration Architecture
Thanks to user-space sandbox isolation, all operating system data structures (virtual memory page tables, file descriptors, execution threads, timers, and the network stack) are safely encapsulated:
1. EVICTION TELEMETRY DETECTED
[TELEMETRY] Provider reclaim signal received (T-120s) • Reserving standby capacity on Host B...
Migration Lifecycle Phases
- Provider Telemetry Monitoring: The microsrv orchestrator continuously ingests hardware and cloud telemetry to anticipate Spot host reclamation windows.
- Pre-copy Phase (Asynchronous Memory Transfer):
- Sandbox kernel state and application memory pages are streamed across high-throughput data center interconnects to the target server.
- The container continues executing instructions and serving live client requests. Newly modified memory pages are marked dirty and re-sent iteratively.
- Stop-and-copy Phase (Under 50 ms):
- Instruction execution is briefly suspended.
- The final differential memory delta and CPU register states are transferred.
- Exclusive write leases for the replicated NVMe volume (Stateful OverlayFS) are handed over to the destination host.
- Atomic eBPF Socket Rerouting:
- eBPF packet-filtering programs atomically update routing entries and socket maps.
- Traffic is instantly redirected to the new host without dropping active TCP connections or generating
Connection reset by peererrors.
Behavior Comparison on Host Reclamation
| Characteristic | Kubernetes (Spot Eviction) | microsrv Containers (Live Migration) |
|---|---|---|
| Downtime | 10–60 seconds (Cold restart) | 0 seconds (pause < 50 ms) |
| RAM State & Caches | Completely wiped | 100% preserved |
| Active TCP Connections | Forcefully closed | Preserved without drop |
| Disk Modifications | Lost (unless PV is configured) | Preserved (Stateful OverlayFS) |
| User Impact | 502/504 errors, broken sessions | Transparent to end users |
Failure Handling
- Graceful Spot Reclamation: Triggers automatic Live Migration with zero downtime.
- Unheralded Hardware Failure (Host Kernel Panic / Power Loss):
If a physical server abruptly terminates without advance warning, RAM state cannot be captured. In this event, the orchestrator triggers an automatic Cold Restart:
- The container is spun up on a healthy node.
- The replicated NVMe volume containing the exact Stateful OverlayFS filesystem is reattached.
- The container retains its original VPC private IP address.
Container Status During Migration
During the migration sequence, the container state property in the Web Console and Selene API is set to Migrating. Once the cutover completes, it automatically returns to Running.