[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: LVM write performance



On 8/9/2011 9:12 AM, Dion Kant wrote:

> Thanks for your remarks. The disk info is given below. Writing to the
> disk is oke when mounted, so I think it is not a hardware/alignment
> issue.  However your remarks made me do some additional investigations:
> 
> 1. dd of=/dev/sdb4 if=/dev/zero gives similar results, so it has nothing
> to do with LVM;
> 2. My statement about writing like this on an openSUSE kernel is wrong.
> Also with openSUSE and the same hardware I get similar (slow) results
> when writing to the disk using dd via the device file.
> 
> So now the issue has diverted to the asymmetric behaviour when
> writing/reading using dd directly through the (block) device file.
> 
> Reading with dd if=/dev/sdb4 of=/dev/null gives disk limited performance
> Writing with dd of=/dev/sdb4 if=/dev/zero gives about a factor 10 less
> performance.

Run:
/$ dd of=/dev/sdb4 if=/dev/zero bs=4096 count=500000

Then run again with bs=512 count=2000000

That will write 2GB in 4KB blocks and will prevent dd from trying to
buffer everything before writing it.  You don't break out of this--it
finishes on it's own due to 'count'.  The second run with use a block
size of 512B, which is the native sector size of the Seagate disk.
Either of these should improve your actual dd performance dramatically.

When you don't specify a block size with dd, dd attempts to "buffer" the
entire input stream, or huge portions of it, into memory before writing
it out.  If you look at RAM, swap usage, and disk IO while running your
'raw' dd test, you'll likely see both memory, and IO to the swap device,
are saturated, with little actual data being written to the target disk
partition.

I attempted to nudge you into finding this information on your own, but
you apparently did not.  I explained all of this not long ago, either
here or on the linux-raid list.  It should be in Google somewhere.
Never use dd without specifying the proper block size of the target
device--never.  For a Linux filesystem this will be 4096 and for a raw
hard disk device it will be 512, optimally anyway.  Other values may
give better performance, depending on the system, the disk controller,
and device driver, etc.

That Seagate isn't an AF model so sector alignment isn't the issue here,
just improper use of dd.

-- 
Stan


Reply to: