bhyve Live Migration: FreeBSD 15.1 Explained13 min read2,648 words

bhyve Live Migration: FreeBSD 15.1 Explained

See how bhyve live migration works on FreeBSD 15.1, what the prototype has tested, its measured downtime, and the engineering gaps before production use.

bhyve live migrationFreeBSD virtualizationbhyve VM migrationpre-copy migrationFreeBSD 15.1
bhyve Live Migration: FreeBSD 15.1 Explained

bhyve Live Migration: What Works, What Does Not, and What Comes Next

Language: English

Moving a running virtual machine between hosts without a visible outage is the kind of requirement that stops being "nice to have" once virtualization is part of daily operations. It lets teams do host maintenance, swap hardware, and rebalance capacity without treating every change like a full guest shutdown. For bhyve on FreeBSD, though, live migration has long felt more talked about than tried.

A work-in-progress implementation for FreeBSD 15.1 changes that. It shows an amd64 guest moving between two hosts over TCP, with the guest paused only for the final stop-and-copy phase. The prototype combines bhyve's experimental snapshot support with kernel-side dirty-page tracking and a migration protocol in bhyve and bhyvectl.

This is a real engineering milestone - but it's not a production-readiness claim. Below is how the prototype works, what the current tests suggest, where the design still needs work, and how operators should think about the results without assuming "it worked once" equals "it's supported."

Why bhyve live migration matters

Live migration isn't just "convenient." In a virtualization platform, it's a core mechanism that makes host maintenance and capacity changes operationally manageable. Without it, upgrades and hardware replacements often turn into coordinated guest downtime - scheduling, communications, and the usual "sorry, everyone will be down" dance.

For FreeBSD-based platforms, that matters in more than one way. A project such as Sylve, which aims to deliver a Proxmox-like virtualization experience on FreeBSD, needs migration as part of the broader toolkit for clustered operations. A control plane can present hosts, guests, and storage cleanly, but without a workable way to move workloads, many maintenance tasks remain disruptive.

The same issue shows up for hosted services. If someone runs BSD-based VPS instances and a host needs maintenance, those workloads either go down or they get moved/restarted elsewhere. That might be acceptable for some services, but it restricts the operational model for workloads that expect continuity. In that context, migration isn't a theoretical feature request - it affects whether the platform fits a given use case.

Why the first working implementation matters

The point of having a working implementation is that it turns the question into something you can actually test. "Copy memory, pause briefly, resume elsewhere" sounds straightforward at the level of desired behavior. Once you implement it, the hard parts show up fast: how to track writes while pages are being copied, how to coordinate device state, and what to do when something goes wrong mid-handoff.

This prototype is explicitly positioned as a work-in-progress RFC. The goal is to give FreeBSD and bhyve users something concrete to review, exercise, and improve. That shifts the discussion away from "would this be useful?" and toward "can this design be made correct, compatible, and maintainable?"

Migration is one part of a system

Transferring guest memory correctly doesn't automatically give you a complete migration system. The source and destination also need compatible CPU and device configurations, a coherent storage model, a network handoff plan, and a commit procedure that keeps the running state consistent. That's why a working demonstration is best treated as a starting point for engineering review - not as the finish line for an operational feature.

How the current migration implementation works

The implementation uses pre-copy migration. The source starts by sending populated guest memory while the VM keeps running. During that transfer, the guest can modify pages that were already copied. Kernel-side dirty-page tracking records those writes so bhyve can send the changed pages in later rounds rather than re-sending the full memory image.

Those rounds continue until a configured stop condition is met. At that point, the remaining dirty set is either small enough to meet the downtime target, stops shrinking, or hits a maximum number of rounds. Then bhyve pauses the guest and devices, sends the final dirty pages, and transfers snapshot state for the virtual CPUs, kernel state, and emulated devices. The destination restores that state and signals readiness.

The commit point and failure behaviour

The handoff includes a distinct commit step. The source sends a GO message only after the destination has received and restored the required state and is ready to continue. If migration fails before GO, the intended behavior is that the source can resume the paused guest. The destination is not supposed to start the VM unless it receives the commit message.

That separation matters because there's a window where both hosts are involved, but only one should own the running guest. A clear commit point helps prevent the destination from starting early while the source is still authoritative. Still, it doesn't remove every distributed-systems failure possibility. For example, an acknowledgement lost after commit can leave operators unsure about which side completed the handoff. That edge needs further design and clear operational guidance.

Warm migration as a comparison and fallback

The implementation also supports a warm, stop-and-copy mode. Instead of repeatedly copying memory while the guest runs, it pauses the guest and transfers state directly. That usually means a longer interruption, but it's useful as a fallback and as a simpler baseline for testing.

Having both modes is practical. Pre-copy is meant to reduce downtime when the workload changes memory slowly enough that dirty pages converge. Stop-and-copy gives a simpler comparison point and a way to finish when memory keeps changing and pre-copy doesn't converge. It also clarifies what "low downtime" really means here: it's a performance outcome, not a promise for every workload.

Keeping bhyve inside its sandbox

The migration socket is opened by bhyvectl and passed into bhyve. That lets bhyve perform migration while staying inside its Capsicum sandbox, instead of forcing it to open a new network connection outside that model. The protocol also checks basic destination properties - its version, page size, memory layout, and vCPU count - before transferring guest state.

Those checks are a starting point, not a full compatibility guarantee. Matching memory size and vCPU count doesn't prove that the two hosts have compatible CPU features, device implementations, snapshot formats, or the right storage and network arrangements.

What testing shows and what it does not

The current two-host test setup has exercised repeated live migrations, memory rewrite workloads, and disk-write workloads. For a slowly dirtying 512 MiB guest, observed downtime has been about 138-171 milliseconds. That's useful early data for this setup, but it shouldn't be treated as a benchmark promise. Downtime will vary with guest behavior, host load, network conditions, and how much state still needs to transfer at the pause point.

A rapidly dirtying guest is a different story. If the guest keeps changing memory faster than the source can copy dirty pages, pre-copy may not converge. The current implementation can still complete by falling back to a final stop-and-copy phase, but the pause will be longer. That's a reasonable safety path, and it also means you can't assume the configured downtime target will apply to every workload.

Memory and device checks

The test workload rewrites guest memory and verifies the contents after migration, specifically to catch missing or stale pages. Dirty tracking covers guest writes and mapped emulation writes through page dirty state; vmm write holds are recorded separately. The tests also use repeated ping-pong migrations to check that the workload keeps running without mismatches.

Disk behavior is tested separately. The guest workload writes files, calls fsync, and verifies checksums. After a cold reboot, the data is checked again, which tests more than "does the VM appear to resume." It also stresses the device pause, drain, and restore path, where a migration might otherwise look successful while still leaving inconsistent results.

Failure cases and limits of the evidence

Tests cover destination refusal, an unreachable target, and a destination disappearing during both pre-copy and stop-and-copy. The intended behavior before commit is for the source to resume a paused guest after a failure. These cases matter because "success on the happy path" doesn't tell you what happens when a host or connection fails mid-handoff.

That said, the evidence is still limited. Published testing has mainly used a one-vCPU guest, so multi-vCPU stress and race testing are still needed before broader claims make sense. The implementation is amd64-only, depends on experimental BHYVE_SNAPSHOT support, and relies on snapshot-capable emulated devices. PCI passthrough isn't migratable in the current scope.

The right way to interpret the results is measured: repeated test migrations and workload checks are encouraging engineering signals, not a full correctness proof or an assurance of production support. This distinction matters if you're considering migration for workloads with availability and data-integrity requirements.

What must be addressed before production use

The biggest technical question is whether dirty-page tracking can be shown to avoid losing writes while dirty bits are examined and cleared. If a write slips through that window, the destination memory could end up stale even if the protocol "finishes" normally. The kernel-side algorithm needs focused concurrency coverage - paging, emulation writes, and multi-vCPU workloads - plus a reviewable explanation of its locking and memory-ordering guarantees.

Compatibility also needs a fuller contract. Current checks cover basic VM geometry, but a destination should eventually validate guest identity, CPU capabilities, bhyve and vmm versions, snapshot-format compatibility, device topology and capabilities, and shared-storage identity. Accepting a guest based only on memory size and vCPU count leaves too many ways for source and destination assumptions to diverge.

Transport and protocol safety

Right now the transport uses TCP without authentication or encryption and relies on a first-version native protocol. That might be fine inside a controlled test environment, but it's not a safe default for real production networks. A stable protocol needs explicit wire formats, bounded message handling, timeouts, and version negotiation. It also needs an authentication and encryption model, or clear guidance for a supported secure external transport - plus operational documentation that makes those assumptions explicit.

Storage, networking, and device side effects

Migration doesn't move a guest in isolation from its environment. Shared storage needs defined coherency, durability, and fencing assumptions. Networking needs a plan for tap/bridge handling, MAC and IP movement, and how long traffic takes to converge after the guest changes hosts.

Device restoration also intersects with the commit boundary. The handoff needs review to ensure restoring a device can't trigger externally visible behavior before the source commits. And if an acknowledgement is lost after commit, operators need a recoverable way to determine which host owns the guest - without guessing.

Tests and reviewability

The existing scripts and test workloads are valuable, but upstream evaluation should include repeatable in-tree regression tests. A documented support matrix should cover CPU counts, memory sizes, supported devices, host CPU compatibility, and failure scenarios. Reviewers and operators need a shared answer to what's been tested, what's supported, and what remains out of scope.

Review also improves when changes are split into smaller patches: dirty-page tracking, snapshot API changes, protocol and receiver logic, command-line changes, and tests. Breaking it up helps reviewers focus on one risk area at a time and makes it easier to respond to feedback. Those are prerequisites for responsible evaluation, not objections to the value of the prototype.

How to evaluate the prototype and its next steps

If you run bhyve or work on FreeBSD virtualization, the next useful step isn't performance tuning. Start by testing the assumptions that affect correctness: dirty pages under concurrent writes, consistent drain/restore behavior for devices, and whether failures before commit reliably leave the source guest usable.

A practical evaluation should define the environment up front. Record FreeBSD and bhyve versions, host CPU capabilities, guest memory and vCPU count, device model, storage layout, and network setup. Then test both a slowly dirtying workload and one that changes memory aggressively. The latter matters because pre-copy convergence depends on the relationship between the guest write rate and transfer capacity.

A focused operator checklist

  • Use a disposable test guest and data set. This is a WIP RFC, not a production support promise.
  • Run memory integrity checks across repeated migrations in both directions, not just a single success case.
  • Exercise disk writes and fsync, verify checksums after migration, and verify again after a cold reboot.
  • Test destination refusal and connection loss during pre-copy and stop-and-copy. Confirm what the source does before commit.
  • Record downtime and whether pre-copy converged, but treat measurements as specific to the workload and test bed.
  • Keep PCI passthrough and unsupported devices out of the test scope unless their behavior has already been explicitly established.

What should come next

The immediate priorities are correctness, compatibility validation, transport safety, and repeatable tests. Compression, zero-page elision, wider device support, richer orchestration, and performance tuning can follow once the base behavior is trustworthy. Adding speed optimizations before validating dirty-log correctness just makes the system faster to evaluate - not safer to operate.

The RFC is also a chance to gather design feedback from the FreeBSD community and from teams building related projects such as Sylve and BoxyBSD. The most productive contributions are straightforward: reproduce a test, identify a missing failure case, review a compatibility assumption, or help make a test repeatable. That moves the work toward something supportable faster than treating a single successful demo as the end of the process.

Conclusion

The bhyve live-migration prototype demonstrates the core flow: pre-copy guest memory, track changed pages, pause for final state transfer, restore on the destination, and commit the handoff. Early memory and disk workload tests look promising, and the measured downtime gives a concrete reason to keep pushing this work.

But the real engineering decision isn't "is migration useful?" It's whether correctness, compatibility, transport security, storage/network assumptions, and failure recovery can be made explicit and repeatable. Treat the current work as a testable RFC, not a production feature. The next milestone should be stronger evidence and a design that reviewers can reason about end to end, with performance improvements following once the foundation holds.

Frequently Asked Questions

A work-in-progress implementation demonstrates live migration for amd64 bhyve guests on FreeBSD 15.1. It is an RFC-stage prototype that depends on experimental snapshot support. It should not be interpreted as a generally available, production-supported feature.
Pre-copy transfers guest memory while the VM continues running, then sends pages changed during earlier transfer rounds. The guest pauses for the final state transfer. If the guest changes memory too quickly for the rounds to converge, the final pause can be longer.
In the reported two-host test environment, a slowly dirtying 512 MiB guest had observed downtime of roughly 138–171 milliseconds. This is an early result for a specific workload and setup, not a performance guarantee for other hosts, networks, or guests.
No. The current scope relies on snapshot-capable emulated devices and does not support PCI passthrough migration. The implementation is also amd64-only, and broader multi-vCPU stress testing remains necessary.
Not as described. The prototype transport has no authentication or encryption and uses a first-version native protocol. Production use would require a hardened protocol and a defined security model, or clear guidance for a secure external transport, alongside stronger compatibility and failure-handling guarantees.

Related articles