RaspberryPi - A little USB device speed test

After installing sucessfully Gentoo on my Raspberry Pi, I decided to do a little speed test one of my USB sticks to find the best filesystem to enhance Pi's storage capabilities. The candidate is the SanDisk's Cruzer Blade with 32GB (PCI 0781:5567).

For the test setup I connected the device to my "raspi" and used fdisk to create three partitions, ca. 10GB each (I am not really sure if the test results will differ if running on "one" complete device, I believe not). I only did this step to be a little bit faster in testing by faster switching.

As file system candidates, after some researching, the following were used:
  • ext4
    • Because of being the current Linux default.
  • F2FS
    • Because of being invented for flash based devices.
  • ExFAT
    • Microsoft's flash optimized file system
  • REISERFS
    • To have something more exotic and to see if B-Trees will be an advantage in this case.
  • REISER4FS
    • Unfortunately not available for the Raspi's linux sources.
As first step I did a very simple test using one single file:

dd if=/dev/zero of=tempfile bs=1M count=1024 conv=fdatasync,notrunc  # write test
echo 3 | sudo tee /proc/sys/vm/drop_caches                           # delete buffer cache
dd if=tempfile of=/dev/null bs=1M count=1024                         # read test
dd if=tempfile of=/dev/null bs=1M count=1024                         # read test


Afterwards bonnie++ was used to stress the device.


Ext4
    WRITE:              1073741824 Bytes (1,1 GB) kopiert, 234,011 s, 4,6 MB/s
    READ (W/O CACHE):   1073741824 Bytes (1,1 GB) kopiert, 54,0525 s, 19,9 MB/s
    READ:               1073741824 Bytes (1,1 GB) kopiert, 55,3512 s, 19,4 MB/s
    bonnie++
                        Version  1.97       ------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
                        pv-berry         1G    84  94  4288   5  3354   8   319  88 23329  27  962.8 118
                        Latency               204ms   49079us    4331ms   44610us   26350us    19585us
                        Version  1.97       ------Sequential Create------ --------Random Create--------
                        pv-berry            -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
                                       files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                                          16   830  30 +++++ +++  6401  92   879  30 +++++ +++  3593  92
                        Latency                34261us    1816us   10686us   71554us     935us   13208us
                                  
F2FS
    WRITE:              1073741824 Bytes (1,1 GB) kopiert, 286,242 s, 3,8 MB/s
    READ (W/O CACHE):   1073741824 Bytes (1,1 GB) kopiert, 54,1611 s, 19,8 MB/s
    READ:               1073741824 Bytes (1,1 GB) kopiert, 55,0701 s, 19,5 MB/s
    bonnie++
                        Version  1.97       ------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
                        pv-berry         1G    32  94  4379   9  3374   9   259  73 23838  27  846.2  99
                        Latency               477ms    6014ms    6388ms   61402us   14453us     125ms
                        Version  1.97       ------Sequential Create------ --------Random Create--------
                        pv-berry            -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
                                       files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                                          16  2818  72 +++++ +++  4401  74  3067  76 +++++ +++  3758  66
                        Latency               268ms    8553us   11721us   13882us     432us   20828us
ExFAT
    WRITE:              1073741824 Bytes (1,1 GB) kopiert, 236,287 s, 4,5 MB/s
    READ (W/O CACHE):   1073741824 Bytes (1,1 GB) kopiert, 66,0115 s, 16,3 MB/s
    READ:               1073741824 Bytes (1,1 GB) kopiert, 70,7415 s, 15,2 MB/s
    bonnie++
                        Version  1.97       ------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
                        pv-berry         1G     3  21  4089   9  1370   3   216  66 14628  30  31.7   3
                        Latency              4955ms     605ms    1739ms   95410us   28072us    1119ms
                        Version  1.97       ------Sequential Create------ --------Random Create--------
                        pv-berry            -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
                                       files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                                          16    20   0   100   1   240   5    20   1    70   1    60   1
                        Latency               251ms   73060us   52550us     338ms   74135us     113ms
                        
REISERFS
   WRITE:               1073741824 Bytes (1,1 GB) kopiert, 257,802 s, 4,2 MB/s
   READ (W/O CACHE):    1073741824 Bytes (1,1 GB) kopiert, 54,9202 s, 19,6 MB/s
   READ:                1073741824 Bytes (1,1 GB) kopiert, 54,564 s, 19,7 MB/s
   bonnie++
                        Version  1.97       ------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
                        pv-berry         1G    26  87  4093  16  3162  12   357  97 22670  34  675.1 102
                        Latency               687ms    5086ms    2074ms   33505us   13465us     125ms
                        Version  1.97       ------Sequential Create------ --------Random Create--------
                        pv-berry            -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
                                       files  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP  /sec %CP
                                          16  2277  90 +++++ +++  2417  95  2246  91 +++++ +++  2231  95
                        Latency               13983us    2698us   16398us   15791us    1053us   26036us 


And my winner is: F2FS.

Even if some tests are skipped (represented by "+" in bonnie++'s results) I do not decide to retest with more files. ExFAT seems to be the slowest (very slow sometimes), also it has very low CPU usage, there is no real advantage IHMO. REISERFS also is no option for me, the hope was to be significantly faster with small files. Maybe the results will be differ, if using more test files for bonnie++.

Because of building a home and no specialized high performance server I concentrated on ext4 and F2FS. In the light of having a flashed based, I decided to use F2FS, as it is meat for using with these ones. The performance compared to ext4 is nearly the same, sometimes even slightly faster, but I bet on the longer lifetime for my USB device.

No comments:

Post a Comment