Install Flashcache on CloudLinux and Centos[ZT]

Major issue on a hosting server which serve hundreds of website is remain the same: I/O bottleneck. My curiosity began when I received a newsletter from a VPS provider in US, they said they have added SSD as filesystem cache to their server fleet. I asked my Russian virtualization platform support fellow and he gave me link to Flashcache page.

Flashcache is a kernel module released by Facebook engineer back in April 2010 to speed up database I/O on a standard rotational drive with the speed of SSD. Since it works by caching filesystem blocks, so it can speed anything on the slow rotational disk.
We’ve already use RAID10 with SAS disk on all of our hosting servers, but still I/O bottleneck often happens.

Server Configuration
We have 6 of 2.5″ drive bays on our server and load it up with :

  1. Disk 0 : 150GB SAS (/dev/sdb)
  2. Disk 1 : 120GB Intel 520 SSD (/dev/sdc)
  3. Disk 2 – 5 : 4 x 300GB SAS on RAID10 (/dev/sda)

OS : CloudLinux 6.4
Partitioning :
/dev/sdb3 mounted as /
/dev/sdb1 mounted as /boot
/dev/sda1 (RAID 10) mounted as /var/lib
/dev/sda2 (RAID 10) mounted as /home

Flashcache Installation Goals
I decide to try Flashcache to speed up /dev/sda(1-2) as this partition stored user’s file and database.

Flashcache Installation

Flashcache Installation Goals

  1. Update the whole system to get all packages up to date :

    yum update
  2. Install required packages :

    yum -y install dkms gcc make yum-utils kernel kernel-devel git make gcc-c++ device-mapper
  3. Reboot if you got new kernel version installed during update

  4. Flashcache installation :

    cd /usr/local/src/
    git clone git://github.com/facebook/flashcache.git
    yumdownloader --source kernel-'uname -r
    rpm -ivh kernel-'uname -r'.src.rpm
    make && make install
  5. Since I haven’t touch the SSD, I’ll need to do partitioning and format this “fast and furious disk”.
    I spare 20GB of the disk in order to prevent SSD performance degradation and divide the 100GB disk in equal ratio with my /dev/sda1 and /dev/sda2 size :
    /dev/sdc1 80GB (for /dev/sda2 cache)
    /dev/sdc2 20GB (for /dev/sda1 cache)

  6. I’m going to make a writethrough cache, but https://github.com/facebook/flashcache/blob/master/utils/flashcache is only for writeback. So I’ve made a custom script you based on http://sf-alpha.bjgang.org/files/flashcache. You can download it here :

  1. Edit /etc/fstab and give comment to /home and /var/lib and then reboot!

via. https://piyecarane.wordpress.com/2013/05/12/install-flashcache-on-cloudlinux-and-centos/