Re: LVM write performance
On 08/14/2011 09:14 AM, Dion Kant wrote:
> The good and problematic block sizes do not really coincide with the
> ones I observe with dd, but the odd behaviour is there.
When testing on Linux kernel 2.6.37.6-0.5-xen, I found that a sync()
call did not give any guarantee that the buffers are actually written to
disk. This forced me to start using writing through a file descriptor
so I can use fsync() to determine the moment where the data is really
written to disk. Now the results coincide with the ones obtained with
dd. It is obvious that dd will use file descriptors as well. Forget
about the previous results, they will be wrong because of libgcc stream
buffering and I did not check how these buffers are actually written to
kernel space.
Now I obtain:
dom0-2:~ # ./bw
Writing 1 GB
bs time rate
(bytes) (s) (MiB/s)
128 66.6928 16.0998
256 57.1125 18.8005
512 57.219 18.7655
1024 56.6571 18.9516
2048 55.5829 19.3179
4096 14.9638 71.7558
8192 15.6889 68.4395
16384 16.3382 65.7197
32768 15.2223 70.5372
65536 15.2356 70.4757
131072 15.2417 70.4474
262144 16.4634 65.2201
524288 15.2347 70.4802
Best result is obtained with Stan's golden rule bs=4096 and a lot of
interrupts when the bs is not an integral multiple of 4096.
int fd = open("/dev/sdb4", O_WRONLY | O_APPEND);
...
gettimeofday(&tstart, &tz);
for (int i=0; i<Ntot/N; ++i)
written+=write(fd, buf, N);
fsync(fd);
close(fd);
gettimeofday(&tstop, &tz);
Dion
Reply to: