1. My Ceph Test Cluster Based on Raspberry Pi's and HP MicroServers

    Sun 27 January 2019

    Introduction

    To learn more about Ceph, I've build myself a Ceph Cluster based on actual hardware. In this blogpost I'll discus the cluster in more detail and I've also included (fio) benchmark results.

    This is my test Ceph cluster:

    picluster

    The cluster consists of the following components:

     3 x Raspberry Pi 3 Model B+ as Ceph monitors
     4 x HP MicroServer as OSD nodes (3 x Gen8 + 1 x Gen10)
     4 x 4 x 1 TB drives for storage (16 TB raw)
     3 x 1 x 250 GB SSD (750 GB raw)
     2 x 5-port Netgear switches for Ceph backend network (bonding)
    

    Monitors: Raspberry Pi 3 Model B+

    I've done some work getting Ceph compiled on a Raspberry Pi 3 Model B+ running Raspbian. I'm using three Raspberry Pi's as Ceph monitor nodes. The Pi boards don't break a sweat with this small cluster setup.

    Note: Raspberry Pi's are not an ideal choice as a monitor node because Ceph Monitors write data (probably the cluster state) to disk every few seconds. This will wear out the SD card eventually.

    Storage nodes: HP MicroServer

    The storage nodes are based on four HP MicroServers. I really like these small boxes, they are sturdy, contain server-grade components, including ECC-memory and have room for four internal 3.5" hard drives. You can also install 2.5" hard drives or SSDs.

    For more info on the Gen8 and the Gen10 click on their links.

    Unfortunately the Gen8 servers are no longer made. The replacement, the Gen10 model, lacks IPMI/iLO and is also much more expensive (in Europe at least).

    CPU and RAM

    All HP Microservers have a dual-core CPU. The Gen8 servers have 10GB RAM and the Gen10 server has 12GB RAM. I've just added an 8GB ECC memory module to each server, the Gen10 comes with 4GB and the Gen8 came with only 2GB, which explains the difference.

    Boot drive

    The systems all have an (old) internal 2.5" laptop HDD connected to the internal USB 2.0 header using an USB enclosure.

    Ceph OSD HDD

    All servers are fitted with four (old) 1TB 7200 RPM 3.5" hard drives, so the entire cluster contains 16 x 1TB drives.

    Ceph OSD SSD

    There is a fifth SATA connector on the motherboard, meant for an optional optical drive, which I have no use for and wich is not included with the servers.

    I use this SATA connector in the Gen8 MicroServers to attach a Crucial 250GB SSD, which is then tucked away at the top, where the optical drive would sit. So the Gen8 servers have an SSD installed which the Gen10 is lacking.

    The entire cluster thus has 3 x 250GB SSDs installed.

    Networking

    All servers have two 1Gbit network cards on-board and a third one installed in one of the half-height PCIe slots1.

    backside

    The half-height PCIe NICs connect the Microservers to the public network. The internal gigabit NICs are configured in a bond (round-robin) and connected to two 5-port Netgear gigabit switches. This is the cluster network or the backend network Ceph uses for replicating data between the storage nodes.

    You may notice that the first onboard NIC of each server is connected to the top switch and the second one is connected to the bottom switch. This is necessary because linux round-robin bonding requires either separate VLANs for each NIC or in this case separate switches.

    Benchmarks

    Benchmark conditions

    • The tests ran on a physical Ceph client based on an older dual-core CPU and 8GB of RAM. This machine was connected to the cluster with a single gigabit network card.
    • I've mapped RBD block devices from the HDD pool and the SSD pool on this machine for benchmarking.
    • All tests have been performed on the raw /dev/rbd0 device, not on any file or filesystem.
    • The pools use replication with a minimal copy count of 1 and a maximum of 3.
    • All benchmarks have been performed with FIO.
    • All benchmarks used random 4K reads/writes
        NAME     ID     USED        %USED     MAX AVAIL     OBJECTS
        hdd      36     1.47TiB     22.64       5.03TiB      396434
        ssd      38      200GiB     90.92       20.0GiB       51204
    

    Benchmark SSD

    Click on the images below to see a larger version.

    a b c d e f

    Benchmark HDD

    g h i j k l

    Benchmark evaluation

    The random read performance of the hard drives seems unrealistic at higher queue depths and number of simultaneous jobs. This performance cannot be sustained purely on the basis that 16 hard drives with maybe 70 random IOPs each can only sustain 1120 random IOPs.

    I cannot explain why I get these numbers. If anybody has a suggestion, feel free to comment/respond. Maybe the total of 42GB of memory across the cluster may act as some kind of cache.

    Another interesting observation is that a low number of threads and a small IO queue depth results in fairly poor performance, both for SSD and HDD media.

    Especially the performance of the SSD pool is poor with a low IO queue depth. A probable cause is that these SSDs are consumer-grade and don't perform well with low queue depth workloads.

    I find it interesting that even over a single 1Gbit link, the SSD-backed pool is able to sustain 20K+ IOPs at higher queue depths and larger number of threads.

    The small number of storage nodes and the low number of OSDs per node doesn't make this setup ideal but it does seem to perform fairly decent, considering the hardware involved.


    1. You may notice that the Pi's are missing in the picture because this is an older picture when I was running the monitors as virtual machines on hardware not seen in the picture. 

    Tagged as : Ceph
    If you have any comments email me, see the About page for contact details.
  2. Compiling Ceph on the Raspberry Pi 3B+ (Armhf) Using Clang/LLVM

    Sat 10 November 2018

    UPDATE 2019 / 2020


    There are official ARM64 binaries of Ceph that you can run on a 64-bit version of Ubuntu 18.04.

    Important: I consider this page obsolete. I will keep it up for transparency's sake


    Introduction

    In this blog post I'll show you how to compile Ceph Luminous for the Raspberry Pi 3B+.

    If you follow the instructions below you can compile Ceph on Raspbian. A note of warning: we will compile Ceph on the Raspberry Pi itself which takes a lot of time.

    Ubuntu has packages for Ceph on armhf but I was never able to get Ubuntu working properly on the Raspberry Pi 3B+. Maybe that's just me and I did something wrong. Using existing Ceph packages on Ubuntu would probably be the fastest way to get up and running on the Raspberry Pi if it works for you.

    This is my test Ceph cluster:

    picluster

     3 x Raspberry Pi 3B+ as Ceph monitors. 
     4 x HP Microserver as OSD nodes.
     4 x 4 x 1 TB drives for storage (16 TB raw)
     3 x 1 x 250 GB SSD (750 GB raw)
     2 x 5-port Netgear switches for Ceph backend network (bonding)
    

    For the impatient

    If you just want the packages you can download this file and you'll get a set of .deb files which you need to install on your Raspberry Pi.

    SECURITY WARNING: these packages are created by me, an unknown, untrusted person on the internet. As a general rule you should not download and install these packages as they could be malicious for all you know. If you want to be safe, compile Ceph yourself.

    Skip to the section about installing the packages at the end for further installation instructions.

    The problem with compiling Ceph for armhf

    There are no armhf packages for Ceph because if you try to compile Ceph on armhf the compiler (gcc) will run out of virtual memory (about three gigabytes).

    The solution

    Daniel Glaser discovered that he could actually compile Ceph on armhf by using Clang/LLVM as the C++ compiler. This compiler seems to use less memory and thus stay within the 3 GB memory boundary. This is why he and I were able to compile Ceph.

    How to compile Ceph for armhf - preparation

    The challenge: one gigabyte of memory

    The Raspberry Pi 3B+ has only one gigabyte of memory but we need more. The only way to add memory is to use swap on disk, as far as I know.

    If you use storage as a substitute for RAM memory, you need fast storage, so it's really recommended to use an external SSD drive that you connect through USB. You also may need sufficient storage, I'd recommend 20+ GB.

    SD memory cards are not up to the task regarding being used as swap. You'll wear them out prematurely and performance is abysmal. You should really use an external SSD.

    Preparing the external SSD

    Attach the SSD drive to the Raspberry Pi with USB
    
    1. The SSD will probably show up as '/dev/sda'.
    2. mkfs.xfs /dev/sda -f ( this will erase all contents of the SSD ).
    3. mkdir /mnt/ssd
    4. mount /dev/sda /mnt/ssd

    Creating and activating swap

    1. cd /mnt/ssd
    2. dd if=/dev/zero of=swap.dd bs=1M count=5000
    3. swapon /mnt/ssd/swap.dd
    4. swapoff /var/swap

    By default, Raspbian configures a 100 MB swap file on /var/swap. In order to increase performance and protect the SD card from wearing out, please don't forget this last step to disable this swap file on the SD card.

    Extra software

    I would recommend installing 'htop' for real-time monitoring of cpu, memory and swap usage if you like to do so.

    1. apt-get install htop

    How to compile Ceph for armhf - building

    Installing an alternative C++ compiler (Clang/LLVM)

    As part of Daniel's instructions, you need to compile and install Clang/LLVM. I followed his instructions to the letter, I have not tested the Clang/LLVM packages made available through apt.

    Compiling Clang/LLVM takes a lot of time. It took 8 hours to compile LLVM/Clang on a Raspberry Pi 3B+ with make -j3 to limit memory usage.

    real    493m38.472s
    user    1223m39.063s
    sys 45m45.748s
    

    I'll reproduce the steps from Daniel here:

    apt update
    apt install -y build-essential ca-certificates vim git 
    apt install libcunit1-dev libcurl4-openssl-dev python-bcrypt python-tox python-coverage
    
    cd /mnt/ssd
    mkdir git && cd git
    git clone https://github.com/llvm-mirror/llvm.git
    cd llvm/tools
    git clone https://github.com/llvm-mirror/clang.git
    git clone https://github.com/llvm-mirror/lld.git
    cd /tmp
    mkdir llvm-build && cd llvm-build
    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=ARM /mnt/ssd/git/llvm/
    make -j3
    make install
    update-alternatives --install /usr/bin/cc cc /usr/local/bin/clang 100
    update-alternatives --install /usr/bin/c++ c++ /usr/local/bin/clang++ 100
    update-alternatives --install /usr/bin/cpp cpp /usr/local/bin/clang-cpp 100
    

    You may chose to build in some other directory, maybe on the SSD itself. I'm not sure if that makes a big difference. Be carefull when using /tmp as all contents are lost after a reboot.

    Obtaining Ceph

    There are two options: 1. clone my Luminous fork containing the branch 'ceph-on-arm' which incorporates all the 'fixed' files that make Ceph build with Clang/LLVM.

    1. Clone the official Ceph repo and use the luminous branche. Next, you edit all the relevant files and make the changes yourself. Here you can find a list of all the files and the changes made to them.

    I would recommend to just git clone ceph like this:

    cd /mnt/ssd
    git clone https://github.com/louwrentius/ceph
    cd ceph
    git checkout ceph-on-arm
    git reset --hard
    git clean -dxf
    git submodule update --init --recursive
    

    Now we first need to install a lot of dependancies on the Raspberry Pi before we can build Ceph.

    run ./install-deps.sh
    

    This will take some time as a ton of packages will be installed. Once this is done we are ready to compile Ceph itself.

    Building Ceph

    So to understand what you are getting into: it took me about 12 hours to compile Ceph on a Raspberry Pi 3 B+

    real    717m31.457s
    user    1319m50.438s
    sys 58m7.549s
    

    This is the command to run:

    ./make-debs.sh
    

    If you want to monitor cpu and memory usage, you can use 'htop' to do so.

    If for some reason the compile proces does fail and you may have to restart compiling ceph after you made some adjustments:

    (you may have to adjust the folder name to match your ceph version)

    cd /tmp/release/Raspbian/WORKDIR/ceph-12.2.9-39-gd51dfb14f4
    < edit the relevant files here >
    dpkg-buildpackage -j3 -us -us -nc
    

    Once this process is done, you will find a lot of .deb packages in your /tmp/release/Raspbian/WORKDIR folder.

    Warning If you do use /tmp, the first thing to do is to copy all .deb files to a safe location because if you reboot your Pi, you loose 12 hours of work.

    Assuming that you copied all .deb files to a folder like '/deb' you just created, this is how you install these packages:

    dpkg --install *.deb
    apt-get install --fix-missing
    apt --fix-broken install
    

    This is a bit ugly but it worked fine for me.

    You can now just copy over all the .deb files to other Raspbery Pi's and install Ceph on them too.

    Now you are done and you can run Ceph on a Raspberry Pi 3B+.

    Ceph monitors may wear out the SD card

    Important Running a Ceph monitor node on a Raspberry Pi is not ideal. The core issue is that the Ceph monitor process writes data every few seconds to files within /var/lib/ceph and this may wear out the SD card prematurely. The solution would be to use an external usb hard drive mounted through USB or a regular ssd which is way more resilient to writes than a regular SD card.

    Tagged as : Ceph
    If you have any comments email me, see the About page for contact details.

Page 1 / 2