Install Flashcache on CloudLinux and Centos


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 :
    script to make cache and mount /home
    script to make cache and mount /var/lib
  7. Edit /etc/fstab and give comment to /home and /var/lib and then reboot!
Advertisements

About piyecarane

Bla bla bla about me
This entry was posted in Linux and tagged , , . Bookmark the permalink.

7 Responses to Install Flashcache on CloudLinux and Centos

  1. nmnmnm says:

    ok, and what next? charts, speed test? How this works?

  2. backtogeek says:

    Unmaintained blogs with broken links are literally the most annoying thing in the IT world.

    • piyecarane says:

      You can just tell me and ask for correction politely if you found a broken link on my post instead of saying that this blog is annoying.
      Your comment is personally annoying to me!

      • Jota says:

        Sounds like a bot to me ….

      • backtogeek says:

        sorry, not a bot, this was my micro rant after spending hours trying to find answers and only finding this blog post over and over again, sorry about that.

        The second link in stage 6 is dead, also you jump directly to make && make install in your instructions which attempts to make in and empty directory. 🙂

  3. Jota says:

    BTW, post the advantages of this Flashcache to see how it goes. Thanks !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s