How important is PE Size for KVM virtualization?

mario asked:

How important is PE Size for KVM virtualization ? Some people say that is useless to follow SolusVM instructions for KVM by setting PE Size from default 4M to 32M.

My answer:

The kernel uses a small amount of memory for each physical extent that exists in mounted LVM volumes. So setting a larger PE size can save memory if you are severely memory constrained. For a server intended for virtualization, you should not be memory constrained.

Also, tools which manage LVM may have to traverse the list of physical extents, and if there are more of them, then the tools will work more slowly. This doesn’t affect regular day-to-day I/O, just using management tools.

However, setting the PE size very large can result in wasted space, up to slightly less than the size of a PE per physical disk. With today’s multi-terabyte drives, losing up to 31.9MB (32MB PE size) is really minor, but in the past when drives were only multi-gigabyte this was a serious consideration.

The PE size, of course, also affects how you can size your LVs, since the size of an LV must be a multiple of the PE size. So setting the PE size higher than 1GB or so is probably not useful.

In the end, the 32MB PE size seems perfectly reasonable for a virtualization server. You may even want to increase it further. For the smaller volumes created within the virtual machines, you probably want to use the system defaults, or 4MB, for much the same reasons.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.