Scenario: The Zero-Downtime Edge Handover
A student is architecting a load-balancing system for a dense LTE/5G network. When an edge computing server at Cell Tower A becomes overloaded, the orchestrator must migrate a user’s actively running backend process (e.g., a real-time object detection stream) to Cell Tower B. The student claims they will achieve “zero downtime” by simply pausing the container, copying it over the backhaul, and unpausing it.
Q:The student pauses the process and copies the RAM state to Tower B. Tower B resumes the process and starts sending data back to the mobile client. However, the client immediately terminates the connection with a TCP RST (Reset) packet. Why did the protocol reject the data? Reveal â–¾
Because the TCP state machine is strictly bound to a 4-tuple: (Source IP, Source Port, Destination IP, Destination Port).
Even if the application memory is perfectly preserved, Tower B has a different physical IP address than Tower A. When Tower B sends a packet, the Source IP changes. The client’s OS kernel does not recognize this new IP as being part of the established TCP session. It assumes it is receiving rogue packets for a non-existent connection and violently tears it down with an RST flag.
Q:To fix this, you suggest placing a Layer 4 Load Balancer (Proxy) in front of the edge servers. How does this solve the 4-tuple problem during a live migration? Reveal â–¾
The L4 Proxy acts as the TCP termination point for the client. The client maintains a single, persistent TCP connection to the Proxy’s static IP.
The Proxy then maintains a separate backend TCP connection to Tower A. When the migration occurs, the Proxy buffers the incoming client data, tears down the backend connection to Tower A, establishes a new backend connection to Tower B, and splices the streams together. The mobile client remains completely oblivious to the handover because its frontend connection to the Proxy’s IP never dropped.
Q:The network is fixed, but now you have a physics problem. The process uses 4GB of RAM. Over a 1Gbps fiber backhaul, copying 4GB takes exactly 32 seconds. If you pause the process to copy the memory, the user experiences a 32-second freeze. How do hypervisors achieve ’live’ migration without pausing the application? Reveal â–¾
They use a Pre-Copy Memory Migration algorithm.
Instead of pausing the process, the OS leaves the application running on Tower A. In the background, a migration thread begins copying the 4GB of RAM over to Tower B, page by page. The application continues to serve the user without interruption while the memory is being cloned over the network.
Q:But while the background thread is copying pages 1 through 100, the actively running application modifies the data on page 5. Tower B now has stale, corrupted data. How does the Operating System track these real-time modifications without slowing down the application? Reveal â–¾
The OS leverages the hardware’s Memory Management Unit (MMU) by intentionally triggering Page Faults.
Before the background copy starts, the OS marks all the memory pages of the application as “Read-Only” in the Page Table. When the application attempts to write to page 5, the CPU hardware blocks it and throws a Page Fault exception. The OS intercepts this interrupt, notes in a hidden bitmap that page 5 is now “dirty,” changes the page permissions back to “Read/Write,” and lets the application complete its modification.
Once the initial 4GB copy finishes, the migration thread looks at the dirty bitmap and executes a second, much smaller copy pass just for the modified pages. It repeats this iteratively until the delta is small enough to transfer in a few milliseconds.
Q:The iterative copy has reduced the dirty pages to just a few kilobytes. It is time for the final cutover. The OS pauses the process on Tower A for just 10 milliseconds. What is the absolute final, microscopic payload that must be sent to Tower B to make the process wake up and resume exactly where it left off? Reveal â–¾
The CPU Context (Hardware Registers).
The absolute final payload contains the Instruction Pointer (which line of code executes next), the Stack Pointer (where the top of the call stack is), and the state of all general-purpose and floating-point registers.
Tower A sends this microscopic state, Tower B’s OS loads these values directly into the physical CPU cores, and the process resumes execution at the exact machine-code instruction where it was paused, completely unaware that it just teleported across a city.
Variations & Real-World Impact
- Virtual Machine vs. Container Migration: True live migration of VMs (like VMware vMotion or KVM live migration) is mature because the hypervisor has total control over the MMU and guest OS memory. Migrating Docker/Linux containers natively (via tools like CRIU - Checkpoint/Restore In Userspace) is much more complex because containers share the host kernel, requiring the OS to painstakingly serialize open file descriptors, active sockets, and namespace states.
- Edge Computing in 5G: In modern MEC (Multi-access Edge Computing), users in fast-moving vehicles (like high-speed trains) rapidly cross cell boundaries. The strict latency requirements of autonomous driving systems mean pre-copy algorithms must preemptively begin cloning state to the next tower based on physical trajectory prediction before the radio handover even initiates.
Discussion & Comments