Uncategorized

microSD Card Benchmarks

Drupal 8 on a cluster of Raspberry Pis

 

microSD Card Benchmarks

In my experience, one of the highest-impact upgrades you can perform is to buy the fastest possible microSD card—especially for applications where you need to do a lot of random reads and writes.

There is an order-of-magnitude difference between most cheap cards and the slightly-more-expensive ones (even if both are rated as being in the same class)—especially in small-block random I/O performance. As an example, if you use a normal, cheap microSD card for your database server, normal database operations can literally be 100x slower than if you used a standard microSD card.

Because of this, I went and purchased over a dozen different cards and have been putting them through their paces. Here are the results of those efforts, in a nice tabular format:

Pi models tested

Click on a Pi model to see microSD benchmarks run on that Pi.

Rasbperry Pi 4 model B

Card Make/Model hdparm buffered dd write 4K rand read 4K rand write
Samsung Pro+ 32GB 43.90 MB/s 39.6 MB/s 10.77 MB/s 2.61 MB/s
Samsung Pro Endurance U1 32GB 43.52 MB/s 37.4 MB/s 10.21 MB/s 2.83 MB/s
Samsung Pro 16GB 43.86 MB/s 38.6 MB/s 10.49 MB/s 1.74 MB/s
Samsung Evo Plus 64GB 43.45 MB/s 22.4 MB/s 7.93 MB/s 2.37 MB/s
Samsung Evo+ 32GB 43.92 MB/s 21.3 MB/s 10.80 MB/s 3.85 MB/s
Samsung Evo 16GB 43.40 MB/s 12.1 MB/s 7.09 MB/s 1.24 MB/s
NOOBS (1.4, C6) 8GB 43.15 MB/s 6.6 MB/s 7.14 MB/s 1.05 MB/s
SanDisk Extreme U3 V30 A2 64GB 43.73 MB/s 36.3 MB/s 7.35 MB/s 3.70 MB/s
SanDisk Extreme Pro A1 32GB 43.87 MB/s 38.8 MB/s 9.82 MB/s 4.70 MB/s
SanDisk Extreme Pro 8GB 43.78 MB/s 35.5 MB/s 9.22 MB/s 1.25 MB/s
SanDisk Extreme 16GB 43.95 MB/s 39.5 MB/s 9.46 MB/s 2.46 MB/s
SanDisk Ultra 16GB 42.30 MB/s 8.2 MB/s 6.57 MB/s 1.52 MB/s
Lexar Professional U3 A2 V30 128GB 44.35 MB/s 32.4 MB/s 9.65 MB/s 2.55 MB/s
Sony C10 U3 32GB 40.78 MB/s 35.7 MB/s 1.58 MB/s 0.66 MB/s
Toshiba C10 U1 16GB 41.62 MB/s 12.0 MB/s 6.62 MB/s 0.22 MB/s

Rasbperry Pi 3 model B+

Card Make/Model hdparm buffered dd write 4K rand read 4K rand write
Samsung Pro+ 32GB 21.89 MB/s 19.7 MB/s 8.59 MB/s 2.14 MB/s
Samsung Pro 16GB 21.85 MB/s 21.6 MB/s 8.42 MB/s 1.34 MB/s
Samsung Evo Plus 64GB 21.71 MB/s 19.5 MB/s 7.87 MB/s 2.33 MB/s
Samsung Evo+ 32GB 21.98 MB/s 15.8 MB/s 8.63 MB/s 3.17 MB/s
Samsung Evo 16GB 18.62 MB/s 11.3 MB/s 5.73 MB/s 0.93 MB/s
NOOBS (1.4, C6) 8GB 18.81 MB/s 6.5 MB/s 6.35 MB/s 0.99 MB/s
SanDisk Extreme Pro 8GB 22.06 MB/s 20.2 MB/s 8.16 MB/s 1.21 MB/s
SanDisk Extreme 16GB 22.15 MB/s 20.6 MB/s 8.31 MB/s 2.21 MB/s
SanDisk Ultra 16GB 21.09 MB/s 8.2 MB/s 5.93 MB/s 1.57 MB/s
Sony C10 U3 32GB 19.51 MB/s 18.5 MB/s 2.26 MB/s 0.65 MB/s

Rasbperry Pi 3 model B

Card Make/Model hdparm buffered dd write 4K rand read 4K rand write
Samsung Pro+ 32GB 21.88 MB/s 20.2 MB/s 9.61 MB/s 2.16 MB/s
Samsung Pro 16GB 21.62 MB/s 22.1 MB/s 9.41 MB/s 1.66 MB/s
Samsung Evo+ 32GB 21.77 MB/s 15.8 MB/s 9.66 MB/s 3.43 MB/s
Samsung Evo Select 32GB 19.59 MB/s 5.7 MB/s 4.34 MB/s 0.71 MB/s
Samsung Evo 16GB 20.08 MB/s 10.4 MB/s 6.02 MB/s 1.02 MB/s
SanDisk Extreme Pro 8GB 21.02 MB/s 21.2 MB/s 9.07 MB/s 1.25 MB/s
SanDisk Extreme 16GB 22.08 MB/s 21.8 MB/s 9.44 MB/s 2.42 MB/s
SanDisk Ultra 16GB 20.79 MB/s 7.9 MB/s 5.98 MB/s 1.57 MB/s

Rasbperry Pi 3 model B – overclocked microSD

You can double the microSD card reader’s speed by adding an extra dtoverlay configuration inside /boot/config.txt (for instructions, see How to overclock the microSD card reader in the Raspberry Pi 3).

Card Make/Model hdparm buffered dd write 4K rand read 4K rand write
Samsung Pro+ 32GB 39.93 MB/s 31.0 MB/s 12.15 MB/s 1.84 MB/s
Samsung Pro 16GB1 31.59 MB/s 32.8 MB/s 11.20 MB/s 1.48 MB/s
Samsung Evo+ 32GB 37.68 MB/s 20.0 MB/s 12.20 MB/s 3.75 MB/s
Samsung Evo Select 32GB 24.56 MB/s 13.2 MB/s 4.69 MB/s 0.82 MB/s
Samsung Evo 16GB 32.47 MB/s 11.8 MB/s 6.44 MB/s 1.25 MB/s
SanDisk Extreme Pro 8GB 40.52 MB/s 35.9 MB/s 11.31 MB/s 1.28 MB/s
SanDisk Extreme 16GB 40.88 MB/s 39.1 MB/s 11.77 MB/s 2.36 MB/s
SanDisk Ultra 16GB 37.41 MB/s 8.5 MB/s 6.71 MB/s 1.61 MB/s

1 The Samsung Pro refused to overclock to 100 MHz; I could only overclock at 80 MHz reliably.

Rasbperry Pi 2 model B

Card Make/Model hdparm buffered dd write 4K rand read 4K rand write
OWC Envoy SSD (USB) 64GB 34.13 MB/s 34.4 MB/s 7.06 MB/s 8.20 MB/s
SanDisk Ultra Fit (USB) 32GB 31.72 MB/s 14.5 MB/s 4.99 MB/s 1.07 MB/s
Samsung Pro+ 32GB 21.75 MB/s 18.7 MB/s 8.31 MB/s 1.75 MB/s
Samsung Pro 16GB 18.39 MB/s 18.2 MB/s 7.66 MB/s 1.01 MB/s
Samsung Evo+ 32GB 18.45 MB/s 14.0 MB/s 8.02 MB/s 3.00 MB/s
Samsung Evo 16GB 17.39 MB/s 10.4 MB/s 5.36 MB/s 1.05 MB/s
SanDisk Extreme Pro 8GB 18.43 MB/s 17.6 MB/s 7.52 MB/s 1.18 MB/s
SanDisk Extreme 16GB 18.51 MB/s 18.3 MB/s 8.10 MB/s 2.30 MB/s
SanDisk Ultra 16GB 17.73 MB/s 7.3 MB/s 5.34 MB/s 1.52 MB/s
NOOBS (1.4, C6) 8GB 17.62 MB/s 6.5 MB/s 5.63 MB/s 1.01 MB/s
Transcend Premium 300x 32GB 18.14 MB/s 10.3 MB/s 5.21 MB/s 0.84 MB/s
PNY Turbo (C10 90MB/s) 16GB 17.46 MB/s TODO 6.25 MB/s 0.62 MB/s
Toshiba (C10 40MB/s) 16GB 17.66 MB/s 11.2 MB/s 5.21 MB/s 0.21 MB/s
Sony (C10 70MB/s) 16GB 15.38 MB/s 8.9 MB/s 2.47 MB/s 0.24 MB/s
Kingston (C10) 16GB 17.78 MB/s 9.0 MB/s 5.75 MB/s 0.21 MB/s
Kingston (C10) 8GB 12.80 MB/s 7.2 MB/s 5.56 MB/s 0.17 MB/s
Nasya (C10) 16GB 16.05 MB/s 8.4 MB/s 2.28 MB/s 0.38 MB/s
No-name (C4) 4GB 13.37 MB/s Sad Painful Excruciating

Benchmarks

All the benchmarks can be run quickly and easily by running a shell script in the Raspberry Pi Dramble repository:

curl https://raw.githubusercontent.com/geerlingguy/raspberry-pi-dramble/master/setup/benchmarks/microsd-benchmarks.sh | sudo bash

hdparm buffered

sudo hdparm -t /dev/mmcblk0

Rationale: hdparm gives basic raw throughput stats for buffered reads (by the disk/device itself). You could also test with -T instead of -t to test the OS filesystem cache performance (which allows the OS to dramatically speed up certain read operations), but for our purposes we just want to test the device itself.

Setup:

  1. Install hdparm: sudo apt-get install -y hdparm

dd write

sudo dd if=/dev/zero of=/home/pi/test bs=8k count=50k conv=fsync; sudo rm -f /home/pi/test

Rationale: dd simply copies data from one place (if) to another (of). If your filesystem caches are big enough, this is a pretty poor disk speed comparison test. Because of that, make sure that count is set to a parameter large enough to cause the OS to actually write data to the drive (e.g. 50k 8k blocks ~= 400 MB, which shouldn’t be able to be cached on a microSD card in a Pi!.

iozone 4K Random read/write

iozone -e -I -a -s 100M -r 4k -i 0 -i 1 -i 2 [-f /path/to/file]

Rationale: iozone is a very robust filesystem benchmark tool, which does a lot of useful tests that make sure you’re getting a broad overview of read and write performance for a variety of block sizes and situations. I like the lower block size random I/O tests especially, because many operations (like logging data, writing a row to an ACID-compliant database, or bulk loading of data) require as fast of small-block-size random I/O as possible.

Most cheap microSD cards, even if rated as being 100MB/sec+ class 10 cards, can’t sustain anywhere near that rate when writing random data—especially on the Raspberry Pi’s measly data bus. (Note that most of the above benchmarks, when run on a USB 3.0 card reader on my MacBook Air, show 5, 10, or 15 times greater performance in that environment).

Setup:

  1. Download the latest versionwget http://www.iozone.org/src/current/iozone3_434.tar
  2. Expand the tarfile: cat iozone3_434.tar | tar -x
  3. Go into the src folder: cd iozone3_434/src/current
  4. Build the executable: make linux-arm
  5. Symlink the executable into your local bin folder: sudo ln -s /home/pi/iozone_434/src/current/iozone /usr/local/bin/iozone

。END

Categories: Uncategorized

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.