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

Rasbperry Pi 3 model B+

Rasbperry Pi 3 model B

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).

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

Rasbperry Pi 2 model B

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:

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 100 M -r 4 k -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: