Without out of order writes, qemu-img read data in parallel, but issue requests in order, keeping only one in-flight request. With out of order writes, qemu keeps up to 8 in-flight requests by default. Add output#write_out_of_order method. Output plugins that can handle out of order writes should override this method to return true. This enables the -W flag in qemu-img convert. With this change we see significant improvement in the rhv-upload-plugin. Connection time decreased from 7.08 seconds to 3.77 seconds, 88% faster. Compared with last version using single connection, we are now 42% faster. [connection 1 ops, 3.778596 s] [dispatch 547 ops, 2.977509 s] [write 464 ops, 2.703108 s, 355.62 MiB, 131.56 MiB/s] [zero 81 ops, 0.118312 s, 1.22 GiB, 10.31 GiB/s] [flush 2 ops, 0.000222 s] [connection 1 ops, 3.774985 s] [dispatch 555 ops, 2.976595 s] [write 490 ops, 2.685608 s, 352.19 MiB, 131.14 MiB/s] [zero 63 ops, 0.122802 s, 1.20 GiB, 9.80 GiB/s] [flush 2 ops, 0.000203 s] [connection 1 ops, 3.777071 s] [dispatch 564 ops, 2.930730 s] [write 499 ops, 2.631180 s, 323.38 MiB, 122.90 MiB/s] [zero 63 ops, 0.119163 s, 1.17 GiB, 9.86 GiB/s] [flush 2 ops, 0.000255 s] [connection 1 ops, 3.778360 s] [dispatch 528 ops, 2.979062 s] [write 456 ops, 2.676340 s, 318.00 MiB, 118.82 MiB/s] [zero 70 ops, 0.118221 s, 1.08 GiB, 9.18 GiB/s] [flush 2 ops, 0.000202 s] Signed-off-by: Nir Soffer <nsoffer@redhat.com> --- v2v/output_rhv_upload.ml | 2 ++ v2v/types.ml | 1 + v2v/types.mli | 2 ++ v2v/v2v.ml | 1 + 4 files changed, 6 insertions(+) diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml index 40768519..a9dfe39b 100644 --- a/v2v/output_rhv_upload.ml +++ b/v2v/output_rhv_upload.ml @@ -283,6 +283,8 @@ object (* rhev-apt.exe will be installed (if available). *) method install_rhev_apt = true + method write_out_of_order = true + method prepare_targets source_name overlays guestcaps = let rhv_cluster_name = match List.assoc "rhv_cluster" json_params with diff --git a/v2v/types.ml b/v2v/types.ml index 53daefed..a8949e4b 100644 --- a/v2v/types.ml +++ b/v2v/types.ml @@ -536,6 +536,7 @@ class virtual output = object method virtual create_metadata : source -> target list -> target_buses -> guestcaps -> inspect -> target_firmware -> unit method keep_serial_console = true method install_rhev_apt = false + method write_out_of_order = false end type output_settings = < keep_serial_console : bool; diff --git a/v2v/types.mli b/v2v/types.mli index a9b0a70e..f474dcaa 100644 --- a/v2v/types.mli +++ b/v2v/types.mli @@ -512,6 +512,8 @@ class virtual output : object (** Whether this output supports serial consoles (RHV does not). *) method install_rhev_apt : bool (** If [rhev-apt.exe] should be installed (only for RHV). *) + method write_out_of_order : bool + (** Whether this output supports out of order writes. *) end (** Encapsulates all [-o], etc output arguments as an object. *) diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 54f26297..5019290a 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -763,6 +763,7 @@ and copy_targets cmdline targets input output = [ "-n"; "-f"; "qcow2"; "-O"; output#transfer_format t ] @ (if cmdline.compressed then [ "-c" ] else []) @ [ "-S"; "64k" ] @ + (if output#write_out_of_order then [ "-W" ] else []) @ [ overlay_file; filename ] in let start_time = gettimeofday () in if run_command cmd <> 0 then -- 2.26.2