Benchmark USB Flash Drives on Routers

(This post is WIP. Come and see update often.)

I eventually made up my mind on the choice of single-board computers (SBC) that will assist and eventually replace the role of my Asus RT-AC56U as an always-on home server. It's not a Raspberry Pi. My workload will be more towards server side and headless. I won't need, for example, WiFi and camera interface but would be good to have gigabit Ethernet, USB 3.0 and SD socket supporting UHS-I. More to come on my pick once I take the shipment and play with it.

One consideration that took unbelievably longer time to decide is a Micro SD card that will be used as system partition on my SBC. Actually it's not specific to Micro SD cards but picking flash thumbdrives in general. I'm not exactly new to this game. After reading people's research in the SBC communities, I feel like entering a new world, facinating!

A1/A2 application performance classes

To begin with, perhaps we shall start with Android. In earlier years, Android allows people to install applications on Micro SD cards. Later this feature was removed. Now this feature is (or will be) resurrected, thanks to new categories of Micro SD cards that support A1/A2 classes.

A1/A2 app performance class

Source: SD Association's developer guide

A1 class specifies a Micro SD card capable of minimum 1500 read and 500 write random I/O operations per second (IOPS), each operation consisting of a 4KiB chunk. A2 class cards could perform minimum 4000/2000 random R/W IOPS. Random read/write of small chunks is typical workload of operating systems and applications. Its performance is critical for smooth app experience. More details on A1/A2 classes can be found on SD Association's whitepaper (in pdf format).

iozone benchmark tool

The concept behind A1/A2 classes is equally applicable to USB thumbdrives used for running applications on routers, single-board computers and other IoT devices. On Windows, we have well known benchmark tools e.g. CrystalDiskMark and ATTO Disk Benchmark. On Mac, there is Blacmagic Disk Speed Test. I've never questioned how these benchmarks are implemented. But have seen results on the same USB stick could vary a lot from different tools.

The SBC communities appear to favor a tool called iozone that is not only open source but descently designed and widely available on all platforms. That makes even cross-platform comparison a possibility. If you happen to run Entware on ARMv7 (32-bit) or ARMv8 64-bit devices, you may get my compiled iozone binaries. Instructions follow.

Entware armv7 installation

$ wget -qO- https://gitlab.com/kvic/Entware-Goodies/raw/master/iozone-v3.482-armv7.tar.gz | tar xf - -C /jffs/bin

Note: e.g. Asus RT-AC56U/68U/87U/88U. The above command line installs iozone to /jffs/bin. Replace /jffs/bin with another path of your choice.

Entware aarch64 installation (armv8 64-bit)

$ wget -qO- https://gitlab.com/kvic/Entware-Goodies/raw/master/iozone-v3.482-aarch64.tar.gz | tar xf - -C /jffs/bin

Note: e.g. Asus RT-AC86U

Uninstall

$ rm /jffs/bin/iozone

Run the benchmark

iozone will test the target drive of your current directoy and operations are non-destructive to the drive. It creates a temporary file of size specified in -s for read and write and delets the file after test done.

$ cd /opt
$ /jffs/bin/iozone -e -I -a -s 20M -r 4k -r 16k -r 512k -r 1024k -r 16384k -i 0 -i 1 -i 2

                                                   random    random
   kB  reclen    write  rewrite    read    reread    read     write
20480       4     4628     4697    19021    19119     6206     3977
20480      16    16030    16768    51271    50867    22272    13536
20480     512    48162    75564    91575    92086    80767    67474
20480    1024    53266    86650    92302    95623    89220    78823
20480   16384    71618    88822   107486   107510   107406    87864

First row represents the read/write performance of chunk size 4KiB. The next row 16KiB and so on. For operating systems and application use, the random read/write of 4KiB chunks is a critical metric. All throughputs are in KiB/s. Divide the numbers from first row and last two columns by 4, you get IOPS roughly. Alternatively, specify '-O' so that iozone display throughputs in IOPS.

The above result shows the throughput of my SanDisk Ultra Flair 64GB USB 3.0 purchased a few years ago. Converting the random read/write into IOPS, my stick has 1551.5 for read and 994.25 for write. Those numbers appear slightly exceeding A1 class.

Over the years, I think memory cards (including USB sticks) are one of the most lucrative products in tech commodities. Vendors charge premium for promoting maximum sequential read speed. Under perform on everyday tasks except copying large files from the memory cards.

I would love to see results on a variety of cards here or elsewhere by running iozone. Keep them coming in!

comments powered by Disqus