Red Hat Bugzilla – Bug 460796
lvm2 should try to align new PV to MD chunksize if possible
Last modified: 2013-02-28 23:06:51 EST
+++ This bug was initially created as a clone of Bug #232843 +++
There is still problem, that if LV over MD is not aligned to md chunk size
(iow beginning of lv is shifted comparing to start sector of md chunk) and some IOs are splitted which slow down performance.
(This is probably most common situation for performance loss now.
Manualy it can be fixed when creating VG - just align metadata to end on md chunk size "pvcreate --metadatasize ...". Unfortunatelly it cannot be fixed if VG is already created...)
LV metadata area should be probably aligned by default if underlying md device has different chunk size - please report new bug if you want to track this issue (it is on my todo list). Also readahead should be optimized here.
I think we can modify pvcreate to detect md chunk size.
(Correcting myself: not metadata need to be aligned, beginning of PE area sould be).
I have already experimental patch, this bug covers it inclusion to lvm2 tools.
Until this patch is available, same question as on the original bug:
should something like that following be done:
c = md chunk size
pvcreate --metadatasize c*n /dev/md#
vgcreate --physicalextentsize c*m foo /dev/md#
And what is the size of the metadata? I.e. what's the minimum value of c*n?
Usptream lvm2 >= 2.02.40 alligns all LVs to md chunksize (configurable in lvm.conf).
It doesn't change default metadata size - this workround works only for the first LV allocated on PV...
Setting to POST until new Fedora build of lvm2 tools available.
Just FYI: please use lvm2 2.02.41 when released or current CVS code - there is nasty bug in LVM2 MD chunksize alignment code causing excessive alignment in 2.02.40
(these last minute changes... :-)
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.
More information and reason for this action is here:
This nasty bug has plagued me for quite a while, and now follows me to Fedora 10 (lvm2-2.02.39-6.fc10.x86_64 kernel-22.214.171.124-117.fc10.x86_64). I get pitifully slow LVM over MD performance, until I manually increase the readahead for each LV to match the MD. I used to do this with a simple "blockdev --setra 4096 /dev/dm-*" workaround in /etc/rc.local, but now use a more appropriate script that sets the readahead to match each device.
I will reproduce my testcase -- https://bugzilla.redhat.com/show_bug.cgi?id=232843#c45 -- when lvm2 2.02.41 is available in f10 updates-testing.
Well, rawhide should have for some time lvm2 which had md chunksize alignment by default switched on (for new PV/VG).
I also sent patch to lvm-devel, which allows manually overwrite alignment through pvcreate commandline paramater (so it can be used even for HW raid devices). This should help optimize performance too.
So only remaining problem is automatically increase readahead valued for md device (but you can already manually increase readahead using --readahead during lvcreate/lvchange, and this value is stored into metadata - so it is automatically applied during activation next time).
Closing this as fixed.
Look forward to trying it in F11 test releases, is it also likely to show up in RHEL6?
md alignment lvm.conf option will be also in RHEL4.8 and it is already in RHEL5.3
I expect that explicit pvcreate --align paramater will be in next update of RHEL (just waiting for review, but I expect it to be in upstream lvm2 2.02.45, then through rebase/backport it propagates to RHEL).
So these changes will be in RHEL6 too.