Optimize SSD storage on Centos 6.6 - KVM

I have a Dell R610 with hardware:

  • H700 raid card
  • 4xMicron MX100 512GB -> configured raid 10

I have installed Centos 6.6 on this server and configured:

  • KVM virtualization
  • Volume Group for raid 10 array
  • Each guest VM using Logical Volumes from Volume Group

I have some questions:

  • Do I need to enable dicard (TRIM) both LVM (KVM host) and guest VM file system (vda)? If yes, then how to do this?
  • How can I monitor SSD endurance?
  • How can I optimize the the performance?

Solution 1:

TRIM works at the filesystem level so as you're giving your KVM domains a raw block device then you need to enable TRIM from within the domain; your host can't know the domains filesystem utilisation without examining it. To enable this you need to ensure there's a discard='unmap' attribute added to the disk definition in the XML for the domain, this is documented at https://libvirt.org/formatdomain.html#elementsDisks .

Setting issue_discards = 1 in /etc/lvm/lvm.conf means that LVM will issue a TRIM to the underlying PV if any logical volume is reduced or deleted. It's not necessary for normal filesystem TRIM operations.

To initiate the actual TRIM operations, it's generally advised to use the fstrim utility rather than adding the discard mount option. Run this periodically from cron or equivalent. Running it manually will also show you if you've actually got everything set up properly too.

To monitor your SSD's I would assume the S.M.A.R.T. tools should suffice, have a look at the output of smartctl -a /dev/sdX.

Optimising generally involves making sure all of your partitions are aligned properly and the same as with normal disks; minimize your writes where necessary. Adding mount options such as noatime, nodiratime, etc.

Solution 2:

How can I monitor SSD endurance?

Install f.e. SMARTmontools, SMART is especially designed for monitoring hard drives, and these days it can monitor SSD parameter the manufactured decied aswell Search for write cycles, power on hours, power on count.

Find out what flash chips you have in your SSD, find the specs for that chip, and get the average write cycles.

From my experience the SSDs did break only on controller issues, not on write cycles, where overprovisioning should take over and replace the broken ones with spares.

How can I optimize the the performance?

Align it to the size of the "sector" size of the chips, you can find that out via specs for your SSD.

Additionally (while true for older drives it might not be needed anymore) you should not fully write the SSD as long as you have other options.

That way the garbage collection can work better.

I think that http://www.storagesearch.com/ssd.html has a lot of information you might want to read into, for a better understanding of SSDs Pros/Cons.

Solution 3:

Tuning the Linux I/O Scheduler. I generally use NOOP for VM or SSD server, the default scheduler is CFQ. You can read more here:

http://dev.nuodb.com/techblog/tuning-linux-io-scheduler-ssds