Ubuntu – LVM Mirrored Logical Volume Performance

linuxlvmUbuntu

I read that when mirroring a logical volume a log of some sort is used to keep the files in sync. You can either set it so this log is in a separate physical volume or in memory. I also read that if the log is in memory, the system has to resync the volumes.

Is there a performance hit for using the log in memory? For example, does it take much longer to boot the machine? Is the data at risk while the resync is happening?

I'm working with Ubuntu 10.04 in this case. I believe it's lvm2. The clearest documentation I've found is the CentOS document here. I was also looking at this description.

Best Answer

Can you add the links you are referring to? Because just mirroring does not need a log. A log (on the same or extra device) is usually involved when you use a journaling filesystem - if you use mirroring or not on the layer below (i.e. the blocklayer).

Update: Ok, with the links things are clearer now. The LVM mirroring seems to be quite different from the linux md (RAID 1) mirroring.

To quote from the lvcreate man page:

Specifying the optional argument "--corelog" will create a mirror with an in-memory log verses a disk-based (persistent) log. While this removes the need for an extra log device and may be slightly faster, it requires that the entire mirror be resynchronized upon each instantiation (e.g. a reboot).

Thus, with a memory based log you get a significant performance hit at startup and a performance hit, when the log physical volume is on the same hardware disk.

Googling around, mirroring using Linux mdadm seems to be the better approach ATM. (You can use the md device as physical device for some lvm setup.)

First, it does not need an extra log (and does not do an expensinve resync at every startup).

Second, lvm mirrors does not seem to support parallel reading, i.e. md mirrors should have better read performance:

https://serverfault.com/questions/97845/lvm-mirroring-vs-raid1

https://serverfault.com/questions/126851/linux-lvm-mirror-vs-md-mirror

Related Question