Skip to content

Commit

Permalink
perf: disable flush on snapshot saving
Browse files Browse the repository at this point in the history
Firecracker is taking significant time on saving the snapshot file. For
comparison: writing the memory snapshot by us (1GiB) takes 1s, and
writing the snapshot file by Firecracker (150KiB) takes 8.5s. We presume
this is because of the syncing of the metadata, which is why we disable
it for now. The filesystem should still handle persisting, and given the
fact that the snapshot/memory files are temporary anyway, we can afford
to not sync/flush.
  • Loading branch information
CompuIves committed Aug 17, 2023
1 parent 84c87c3 commit 6fad03d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/vmm/src/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,14 @@ fn snapshot_state_to_file(
snapshot
.save(&mut snapshot_file, microvm_state)
.map_err(SerializeMicrovmState)?;
snapshot_file
.flush()
.map_err(|err| SnapshotBackingFile("flush", err))?;
snapshot_file
.sync_all()
.map_err(|err| SnapshotBackingFile("sync_all", err))
// Disable the following lines as we're seeing some performance issues with btrfs on these operations
// snapshot_file
// .flush()
// .map_err(|err| SnapshotBackingFile("flush", err))?;
// snapshot_file
// .sync_all()
// .map_err(|err| SnapshotBackingFile("sync_all", err))
Ok(())
}

fn snapshot_memory_to_file(
Expand Down

0 comments on commit 6fad03d

Please sign in to comment.