Conversation
b78bd51 to
f8ebc2c
Compare
| @@ -238,169 +238,174 @@ impl Display for MemoryMigrationContext { | |||
|
|
|||
| #[cfg(test)] | |||
| mod unit_tests { | |||
| use std::time::{Duration, Instant}; | |||
There was a problem hiding this comment.
diff doesn't look that nice 🤔 I just moved everything into sub module memory_migration_ctx_tests
There was a problem hiding this comment.
It will get much cleaner if you enable the "Hide whitespace" option if you are using the GitHub Web UI.
2f0ff71 to
6e4e25b
Compare
c015419 to
cbea647
Compare
likebreath
left a comment
There was a problem hiding this comment.
Looking good. Mostly cosmetic comments.
Great to see more observability for live migration.
| @@ -238,169 +238,174 @@ impl Display for MemoryMigrationContext { | |||
|
|
|||
| #[cfg(test)] | |||
| mod unit_tests { | |||
| use std::time::{Duration, Instant}; | |||
There was a problem hiding this comment.
It will get much cleaner if you enable the "Hide whitespace" option if you are using the GitHub Web UI.
| pub snapshotting_duration: Duration, | ||
| /// The time needed to send the snapshot including deserializing it on the | ||
| /// destination | ||
| pub sending_snapshot_duration: Duration, | ||
| /// The time of the completion request. This includes resuming the VM (if it | ||
| /// was running before the migration). | ||
| pub completing_duration: Duration, |
There was a problem hiding this comment.
Nit: I understand the caller side uses snapshot, I think it is better to stay consistent with the protocol naming, e.g. consider state_duration, send_state_duration, and complete_duration.
There was a problem hiding this comment.
removed the inconsistent state/snapshot naming in favor of snapshot
I'd think state would be better, as that's what the migration protocol uses:
cloud-hypervisor/vm-migration/src/protocol.rs
Lines 111 to 121 in 474106a
There was a problem hiding this comment.
Got it! Will update next week.
There was a problem hiding this comment.
I removed the commit, updated a few identifiers (snapshot -> state) and added this section to the commit message
# Terminology
At first glance, the use of "state" and "[VM] snapshot" may seem
confusing. As discussed in [0], we use "state" consistently in the
migration code. On the VM side, "snapshotting" is merely the mechanism
used to obtain the VM state.
[0] https://github.com/cloud-hypervisor/cloud-hypervisor/pull/7979#discussion_r3061359899
8c220df to
bd985ff
Compare
|
Since your review:
|
bd985ff to
a078a5c
Compare
| ctx.downtime_ctx.effective_downtime.as_millis(), | ||
| send_data_migration.downtime().as_millis() | ||
| ); | ||
| debug!("Downtime breakdown: {}", ctx.downtime_ctx); |
There was a problem hiding this comment.
The new timings are now very very helpful (see PR description) to keep an eye on the downtime as Cloud Hypervisor progresses! After playing around a little, I think I've found the sweet spot for granularity here. Further breaking down the costs should be done in targeted analysis and development; not needed to have that in upstream code
| let (recv_snapshot_dur, restore_vm_dur) = | ||
| self.vm_receive_snapshot(req, socket, config_data.memory_manager)?; | ||
| debug!( | ||
| "Migration (incoming): recv_snapshot:{}ms restore:{}ms", |
There was a problem hiding this comment.
The new timings are now very very helpful (see PR description) to keep an eye on the downtime as Cloud Hypervisor progresses! After playing around a little, I think I've found the sweet spot for granularity here. Further breaking down the costs should be done in targeted analysis and development; not needed to have that in upstream code
a078a5c to
1249b0c
Compare
This helps to better separate the unit tests from the new ones in the following commit. On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
Expose the finalized per-iteration timing fields needed by higher-level migration metrics and factor the iteration-overhead calculation into a small helper. This keeps the existing MemoryMigrationContext behavior intact while making the timing data easier to consume from migration-level context in the following commits. On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
1249b0c to
cd427ef
Compare
Add migration-level context types that extend the existing memory-only metrics with overall migration duration and downtime breakdown. OngoingMigrationContext models the sender-side migration progress until all inputs needed for final downtime accounting are available. CompletedMigrationContext then stores the finalized migration metrics, including the final memory iteration, snapshotting, snapshot transfer, and completion phase. This provides the data needed to log effective downtime in the VMM and lays the groundwork for future migration statistics reporting. # Terminology At first glance, the use of "state" and "[VM] snapshot" may seem confusing. As discussed in [0], we use "state" consistently in the migration code. On the VM side, "snapshotting" is merely the mechanism used to obtain the VM state. [0] cloud-hypervisor#7979 (comment) On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
This is helpful in the following to properly aggregate statistics for local migrations. On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
Add a small helper that returns both the successful result of an operation and the time it took to complete. Subsequent migration instrumentation uses this to keep timing code compact and consistent. On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
Use OngoingMigrationContext to measure and log the effective VM downtime (pause to remote resume) and the cost of each non-trivial step in the downtime window: snapshotting, sending the snapshot, and awaiting completion. This makes it straightforward to identify and reduce downtime as live migration matures. Example: ``` cloud-hypervisor: 7.703402s: <vmm> INFO:vmm/src/lib.rs:1494 -- Migration completed after 2.2s with a downtime of 298ms (goal was 300ms) cloud-hypervisor: 7.703453s: <vmm> DEBUG:vmm/src/lib.rs:1500 -- Downtime breakdown: 298ms (final_iter:269ms state:7ms send_state:19ms complete:1ms) ``` Note: downtime is measured on the source only; cross-host clock skew may cause unreliable results. # Terminology At first glance, the use of "state" and "[VM] snapshot" may seem confusing. As discussed in [0], we use "state" consistently in the migration code. On the VM side, "snapshotting" is merely the mechanism used to obtain the VM state. [0] cloud-hypervisor#7979 (comment) On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
Instrument the two main downtime-phase operations on the destination side - receiving state and resuming the VM - so their costs are visible in logs and can be iterated on. The new log messages may look like this: ```text cloud-hypervisor: 7.283424s: <vmm> DEBUG:vmm/src/lib.rs:948 -- Migration (incoming): recv_snapshot:3ms restore:10ms cloud-hypervisor: 7.284824s: <vmm> DEBUG:vmm/src/lib.rs:967 -- Migration (incoming): resume:1ms cloud-hypervisor: 7.284842s: <vmm> DEBUG:vmm/src/lib.rs:977 -- Migration (incoming): Receiving final state and resuming the VM took 15ms ``` On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
cd427ef to
452ad3f
Compare
rbradford
left a comment
There was a problem hiding this comment.
Nice! Easy to review PR. Thanks.
Add migration-level context types that extend the existing memory-only metrics with overall migration duration and downtime breakdown. OngoingMigrationContext models the sender-side migration progress until all inputs needed for final downtime accounting are available. CompletedMigrationContext then stores the finalized migration metrics, including the final memory iteration, snapshotting, snapshot transfer, and completion phase. This provides the data needed to log effective downtime in the VMM and lays the groundwork for future migration statistics reporting. # Terminology At first glance, the use of "state" and "[VM] snapshot" may seem confusing. As discussed in [0], we use "state" consistently in the migration code. On the VM side, "snapshotting" is merely the mechanism used to obtain the VM state. [0] #7979 (comment) On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
Use OngoingMigrationContext to measure and log the effective VM downtime (pause to remote resume) and the cost of each non-trivial step in the downtime window: snapshotting, sending the snapshot, and awaiting completion. This makes it straightforward to identify and reduce downtime as live migration matures. Example: ``` cloud-hypervisor: 7.703402s: <vmm> INFO:vmm/src/lib.rs:1494 -- Migration completed after 2.2s with a downtime of 298ms (goal was 300ms) cloud-hypervisor: 7.703453s: <vmm> DEBUG:vmm/src/lib.rs:1500 -- Downtime breakdown: 298ms (final_iter:269ms state:7ms send_state:19ms complete:1ms) ``` Note: downtime is measured on the source only; cross-host clock skew may cause unreliable results. # Terminology At first glance, the use of "state" and "[VM] snapshot" may seem confusing. As discussed in [0], we use "state" consistently in the migration code. On the VM side, "snapshotting" is merely the mechanism used to obtain the VM state. [0] #7979 (comment) On-behalf-of: SAP [email protected] Signed-off-by: Philipp Schuster <[email protected]>
2515b06
This PR touches a few areas described in #7111:
Please review this commit-by-commit.
New Log Messages
I performed a local TCP migration of a small VM with a workload.
New log messages on sender:
New log messages on destination:
Learnings
For very small downtimes, we might have to optimize the snapshot path. Future work.