bcache

Changed 2013-04-28 11:03:03


    root@idrift:~# make-bcache -C /dev/sda
    UUID:                   544efd8f-511a-4871-bf08-f6fcbee97dc9
    Set UUID:               c5e083cf-5b3c-4537-a5bf-5d2f4edaf6d6
    nbuckets:               457873
    block_size:             8
    bucket_size:            1024
    nr_in_set:              1
    nr_this_dev:            0
    first_bucket:           1
    
    root@idrift:~# make-bcache --writeback --cache_replacement lru -B /dev/sdb3
    UUID:                   4fad7dc6-8712-444e-ad08-c18912b743f5
    Set UUID:               c1c06516-776b-4a95-8b9a-49994d6fa847
    nbuckets:               11234260
    block_size:             8
    bucket_size:            1024
    nr_in_set:              1
    nr_this_dev:            0
    first_bucket:           1 
    
     echo /dev/sda > /sys/fs/bcache/register
    
    echo /dev/sdb3 > /sys/fs/bcache/register
    
    dmesg
    
    [  222.544841] bcache: run_cache_set() invalidating existing data
    [  222.557870] bcache: register_cache() registered cache device sda
    
    root@idrift:~# mkfs.ext4 /dev/bcache0
    mke2fs 1.42 (29-Nov-2011)
    Discarding device blocks: done
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    179748864 inodes, 1437985278 blocks
    71899263 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4294967296
    43884 block groups
    32768 blocks per group, 32768 fragments per group
    4096 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
            102400000, 214990848, 512000000, 550731776, 644972544
    
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    root@idrift:~# blkid
    /dev/sdb2: UUID="1244082f-d956-4697-a0f8-18513eab20f6" TYPE="ext4"
    /dev/bcache0: UUID="1f822afc-0ed5-4a4f-9915-78744634cac2" TYPE="ext4"
    
    root@idrift:~# mount /dev/bcache0 /mnt/data/
    
    
    bonnie
    
    Version  1.96       ------Sequential Output------ --Sequential Input- --Random-
    Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
    Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
    idrift          63G  1068  98 942087  50 299695  14 +++++ +++ 1688268  33 962.3  37
    Latency              7863us     113ms     616ms   13398us   45210us     143ms
    Version  1.96       ------Sequential Create------ --------Random Create--------
    idrift              -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
                  files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                     16 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++
    Latency                45us     265us     278us      43us       6us      34us
    1.96,1.96,idrift,1,1367070804,63G,,1068,98,942087,50,299695,14,+++++,+++,1688268,33,962.3,37,16,,,,,+++++,+++,+++++,+++,+++++,+++,+++++,+++,+++++,+++,+++++,+++,7863us,113ms,616ms,13398us,45210us,143ms,45us,265us,278us,43us,6us,34us
    sudo -u nobody bonnie  3,60s user 81,81s syste
    
    
    
    20 root@idrift /mnt/data/test # fio /root/testscript.fio
    rw4k: (g=0): rw=read, bs=4K-4K/4K-4K, ioengine=libaio, iodepth=64
    fio 1.59
    Starting 1 process
    rw4k: Laying out IO file(s) (1 file(s) / 8192MB)
    Jobs: 1 (f=1): [R] [100.0% done] [383.4M/0K /s] [95.9K/0  iops] [eta 00m:00s]
    rw4k: (groupid=0, jobs=1): err= 0: pid=20633
      read : io=8192.0MB, bw=394498KB/s, iops=98624 , runt= 21264msec
      cpu          : usr=6.79%, sys=38.47%, ctx=69758, majf=0, minf=82
      IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.0%
         submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
         complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
         issued r/w/d: total=2097152/0/0, short=0/0/0
    
    Run status group 0 (all jobs):
       READ: io=8192.0MB, aggrb=394498KB/s, minb=403966KB/s, maxb=403966KB/s, mint=21264msec, maxt=21264msec
    
    Disk stats (read/write):
      bcache0: ios=2082287/23, merge=0/0, ticks=0/0, in_queue=0, util=0.00%
    
    1 root@idrift /sys # echo c5e083cf-5b3c-4537-a5bf-5d2f4edaf6d6 > /sys/./devices/pci0000:00/0000:00:01.0/0000:01:00.0/host6/target6:2:0/6:2:0:0/block/sdb/sdb3/bcache/attach
    
    [ 1695.906048] bcache: bch_cached_dev_attach() Caching sdb3 as bcache0 on set c5e083cf-5b3c-4537-a5bf-5d2f4edaf6d6
    
    
    root@idrift /mnt/data/test # fio /root/testscript.fio
    rw4k: (g=0): rw=read, bs=4K-4K/4K-4K, ioengine=libaio, iodepth=64
    fio 1.59
    Starting 1 process
    Jobs: 1 (f=0): [R] [100.0% done] [189.7M/0K /s] [47.5K/0  iops] [eta 00m:00s]
    rw4k: (groupid=0, jobs=1): err= 0: pid=22642
      read : io=8192.0MB, bw=391863KB/s, iops=97965 , runt= 21407msec
      cpu          : usr=7.51%, sys=55.82%, ctx=59400, majf=0, minf=84
      IO depths    : 1=0.1%, 2=0.1%, 4=0.1%, 8=0.1%, 16=0.1%, 32=0.1%, >=64=100.0%
         submit    : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
         complete  : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.1%, >=64=0.0%
         issued r/w/d: total=2097152/0/0, short=0/0/0
    
    
    Run status group 0 (all jobs):
       READ: io=8192.0MB, aggrb=391862KB/s, minb=401267KB/s, maxb=401267KB/s, mint=21407msec, maxt=21407msec
    
    Disk stats (read/write):
      bcache0: ios=2096977/26, merge=0/0, ticks=1127340/2008, in_queue=0, util=0.00%
    fio /root/testscript.fio  1,64s user 11,97s system 61% cpu 22,044 total
    
    
    
    Version  1.96       ------Sequential Output------ --Sequential Input- --Random-
    Concurrency   1     -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
    Machine        Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP  /sec %CP
    idrift          63G  1076  99 916762  48 286454  14 +++++ +++ 1445603  39  1068  43
    Latency              7800us   48884us    1124ms    3407us     111ms     148ms
    Version  1.96       ------Sequential Create------ --------Random Create--------
    idrift              -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
                  files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                     16 +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++ +++++ +++
    Latency               277us     267us     278us      44us     621us      35us
    1.96,1.96,idrift,1,1367059938,63G,,1076,99,916762,48,286454,14,+++++,+++,1445603,39,1068,43,16,,,,,+++++,+++,+++++,+++,+++++,+++,+++++,+++,+++++,+++,+++++,+++,7800us,48884us,1124ms,3407us,111ms,148ms,277us,267us,278us,44us,621us,35us
    
    
    root@idrift /mnt/data/test # sudo dd if=/dev/zero bs=64M of=testzero count=$[65535/64] conv=fdatasync
    1023+0 records in
    1023+0 records out
    68652367872 bytes (69 GB) copied, 79,3732 s, 865 MB/s
    sudo dd if=/dev/zero bs=64M of=testzero count=$[65535/64] conv=fdatasync  0,00s user 42,58s system 53% cpu 1:20,15 total
    root@idrift /mnt/data/test # dd if=testzero bs=64M of=/dev/null
    1023+0 records in
    1023+0 records out
    68652367872 bytes (69 GB) copied, 49,4845 s, 1,4 GB/s
    dd if=testzero bs=64M of=/dev/null  0,00s user 18,96s system 38% cpu 49,489 total
    
    
    fix /etc/lvm2/lvm.conf
    types = [ "bcache", 16 ]
    
    
    
    
    
    root@idrift /etc/lvm # pvcreate -d /dev/bcache0
      Physical volume "/dev/bcache0" successfully created
    3 root@idrift /etc/lvm # vgcreate dwalin2 /dev/bcache0
      Volume group "dwalin2" successfully created
    5 root@idrift /etc/lvm # lvcreate -n testvol -L 1t dwalin2
      Logical volume "testvol" created
    
    
    
    
    22 root@idrift /etc/lvm # hdparm -tT /dev/sda
    
    /dev/sda:
     Timing cached reads:   25084 MB in  2.00 seconds = 12556.16 MB/sec
     Timing buffered disk reads: 1212 MB in  3.00 seconds = 403.53 MB/sec
    root@idrift /etc/lvm # hdparm -tT /dev/sdb3
    
    /dev/sdb3:
     Timing cached reads:   25402 MB in  2.00 seconds = 12714.88 MB/sec
     Timing buffered disk reads: 4320 MB in  3.00 seconds = 1439.75 MB/sec
    root@idrift /etc/lvm # hdparm -tT /dev/bcache0
    
    /dev/bcache0:
     Timing cached reads:   25316 MB in  2.00 seconds = 12672.07 MB/sec
     Timing buffered disk reads: 4250 MB in  3.00 seconds = 1416.26 MB/sec
    
    

     

    Watchdog enable
    echo w83627hf_wdt >> /etc/modules
    echo watchdog-device /dev/watchdog >> /etc/watchdog.conf