# HG changeset patch # User Jonathan Davies # Date 1288100552 -3600 # Node ID 5cf0e1279a28ea8f2c4282594b1df39dd47cd6fa # Parent 7e16add444a9b9387aa908f71570baee8c755981 CA-42914, SCTX-434: Speed up writes of the database to the redo-log Anecdotal evidence suggests that the default 1 KiB block size provided by Unixext.read_in_chunks causes write throughput to be very slow on some storage substrates. Some (not massively scientific) timings of dd from /dev/zero to a block-attached VDI on various SR types agree with this observation. The data below shows that 4 KiB is the minimum block size that should be considered for use: throughput it universally higher above this threshold and often substantially lower below it. We'll default to 16 KiB to be on the safe side. lvmoiscsi bs count times throughputs (MB/s) 1024 65536 0m8.461s, 0m7.888s 7.9, 8.5 2048 32768 0m7.986s, 0m8.438s 8.4, 8.0 4096 16384 0m1.529s, 0m1.999s 44.0, 33.6 16384 4096 0m1.289s, 0m1.588s 52.2, 42.3 65536 1024 0m1.550s, 0m1.309s 43.3, 51.3 nfs bs count times throughputs (MB/s) 1024 65536 0m11.865s, 0m12.232s 5.7, 5.5 2048 32768 0m12.612s, 0m12.758s 5.3, 5.3 4096 16384 2.75591, 3.10301 24.4, 21.6 16384 4096 2.96047, 3.42373 22.7, 19.6 65536 1024 3.23713, 3.24731 20.7, 20.7 lvm bs count times throughputs (MB/s) 1024 65536 2.16546, 6.35194 31.0, 10.6 2048 32768 6.24928, 6.44344 10.7, 10.4 4096 16384 0.99237, 0.90683 67.6, 74.0 16384 4096 0.912118, 0.88074 73.6, 76.2 65536 1024 0.934838, 0.881285 71.8, 76.1 Signed-off-by: Jonathan Davies diff -r 7e16add444a9 -r 5cf0e1279a28 ocaml/database/block_device_io.ml --- a/ocaml/database/block_device_io.ml Tue Oct 26 14:42:31 2010 +0100 +++ b/ocaml/database/block_device_io.ml Tue Oct 26 14:42:32 2010 +0100 @@ -324,7 +324,7 @@ (* Otherwise write it *) Unixext.time_limited_write dest_fd len chunk target_response_time; total_length := !total_length + len - ) data_client + ) ~block_size:16384 data_client ) (fun () -> (* Close the connection *)