When you design a computer, whatever its usage is (server, desktop, IoT), at some point, you need to think about storage. This is no different with the Raspberry Pi. Sure, the specifications are pretty straight forward and what you need is a microSD card. A quick look on Amazon.com gives you roughly 270,135 results… And now?
In a project where I want to use my Raspberry Pi as a database server, I wanted to make sure that the storage will not be the bottleneck. When I started studying the storage part, I was not expected to find such differences in results. Some cards clearly did not behave the way they were supposed to.
Methodology
Prior to testing, I wanted to define metrics and a reproducible method. I have some microSD cards, more are coming to the market everyday, so, in order to make the test compatible with the future, I wanted to make sure that the method is documented and proofed.
I am running several sets of tests:
- Writing of an image to the card.
- Various reading tests.
- Various writing tests.
The first test will only measure the bandwidth (or throughput, or data transfer rate) of the card during a “big” write operation. The measure will be in B/s (byte per second).
The reading and writing tests will measure both the throughput and the number of IOPS (Input/Output Operations Per Second).
For more information:
- Read hard disk drive performance characteristics on Wikipedia, and specifically the Data Transfer Rate section.
- Read Input/Output Operations Per Second (IOPS) on Wikipedia.
The details of the processes and tests will appear in a future article (update 2016-03-10, you can now read about the methodology of benchmarking.) Tests have been made using a Raspberry Pi 2.
Five microSD Cards
Brand | SanDisk | SanDisk | SanDisk | SanDisk | Samsung |
Model | Ultra | Ultra PLUS | Ultra PLUS | Extreme | EVO |
Capacity | 64 GB | 64 GB | 64 GB | 64 GB | 64 GB |
Visual differences | Made in China, black PCB, back is flat, red background on front is darker | Made in Taiwan, green PCB, back is slightly bumped, red background on front is lighter | |||
Identifier | 6403 | 6402 | 6401 | 6405 | 6404 |
The identifier is a unique number attached to the microSD cards, to make sure I test and handle the right one.
Results
Pure Writing Test
The pure writing test consists of writing about 4GB of data using the dd command on a MacBook Air, it does not involve the Raspberry Pi.
Brand | SanDisk | SanDisk | SanDisk | SanDisk | Samsung |
Model | Ultra | Ultra PLUS | Ultra PLUS | Extreme | EVO |
Identifier | 6403 | 6402 | 6401 | 6405 | 6404 |
Writing speed (MB/s) | 21.05 | 14.91 | 47.04 | 55.01 | 22.07 |
Raspberry Pi Reading Test
The reading tests are composed of 4 tests of 1, 2, 4, and 6 simultaneous processes reading 128MB on the Raspberry Pi 2, Model B. The first test measures IOPS, the second test measures throughput.
The greener it is, the higher the performance is. The orange and red indicate low performance.
Brand | SanDisk | SanDisk | SanDisk | SanDisk | Samsung |
Model | Ultra | Ultra PLUS | Ultra PLUS | Extreme | EVO |
Identifier | 6403 | 6402 | 6401 | 6405 | 6404 |
IOPS | |||||
Test with 1 reader | 1119 | 1240 | 1854 | 1803 | 1986 |
Test with 2 readers | 1421 | 1300 | 2283 | 2158 | 2382 |
Test with 4 readers | 1424 | 1266 | 2280 | 2146 | 2012 |
Test with 6 readers | 1434 | 1272 | 2214 | 2177 | 1890 |
IOPS Summary | |||||
Average | 1350 | 1270 | 2158 | 2071 | 2068 |
Weighted average | 1405 | 1272 | 2217 | 2136 | 2011 |
Max | 1434 | 1300 | 2283 | 2177 | 2382 |
Throughput (KB/s) | |||||
Test with 1 reader | 4476.1 | 4963.1 | 7419.5 | 7213.3 | 7946.7 |
Test with 2 readers | 5687.3 | 5201.0 | 9137.0 | 8637.8 | 9533.2 |
Test with 4 readers | 5708.7 | 5071.4 | 9130.5 | 8596.8 | 8058.6 |
Test with 6 readers | 5750.2 | 5099.9 | 8872.5 | 8717.8 | 7573.5 |
Throughput (KB/s) Summary | |||||
Average | 5405.6 | 5083.9 | 8639.9 | 8291.4 | 8278.0 |
Weighted average | 5629.8 | 5096.2 | 8880.8 | 8552.5 | 8053.0 |
Max | 5750.2 | 5201.0 | 9137.0 | 8717.8 | 9533.2 |
Raspberry Pi Writing Test
The writing tests are composed of 3 tests of 1, 2, and 4 simultaneous processes writing 2048MB (2GB) on the Raspberry Pi 2, Model B. As with the reading test, the first test measures IOPS, the second test measures throughput. I did not test the two first cards as reading performance was already bad.
Brand | SanDisk | SanDisk | SanDisk | SanDisk | Samsung |
Model | Ultra | Ultra PLUS | Ultra PLUS | Extreme | EVO |
Identifier | 6403 | 6402 | 6401 | 6405 | 6404 |
IOPS | |||||
Test with 1 writer | 566 | 342 | 484 | ||
Test with 2 writers | 417 | 351 | 370 | ||
Test with 4 writers | 342 | 259 | 319 | ||
IOPS Summary | |||||
Average | 442 | 317 | 391 | ||
Weighted average | 395 | 297 | 357 | ||
Max | 566 | 351 | 484 | ||
Throughput (KB/s) | |||||
Test with 1 writer | 2264.8 | 1370.9 | 1937.2 | ||
Test with 2 writers | 1672.2 | 1410.2 | 1482.7 | ||
Test with 4 writers | 1376.4 | 1048.3 | 1284.6 | ||
Throughput (KB/s) Summary | |||||
Average | 1771.1 | 1276.5 | 1568.2 | ||
Weighted average | 1587.8 | 1197.8 | 1434.4 | ||
Max | 2264.8 | 1410.2 | 1937.2 |
Read / Write Ratio
The ratio between read and write indicates the card’s flexibility. If the card is going to be used in a camera, writing happens once per file then reading can happen one or many times. The scenario is different in a phone. I want to use those cards in database servers where there is constant I/O.
Brand | SanDisk | SanDisk | SanDisk | SanDisk | Samsung |
Model | Ultra | Ultra PLUS | Ultra PLUS | Extreme | EVO |
Identifier | 6403 | 6402 | 6401 | 6405 | 6404 |
Ratio | |||||
IOPS | 489% | 653% | 529% | ||
Throughput | 488% | 650% | 528% | ||
Ratio on weighted average | |||||
IOPS | 561% | 719% | 563% | ||
Throughput | 559% | 714% | 561% |
Conclusion
All cards are definitely not equal.
The Samsung EVO’s performances decrease as you increase the load through the number or simultaneous processes.
The microSD card that is the most flexible and fits my needs is definitely the SanDisk Ultra PLUS. The performance are consistent through the load. However, I had 2 from different batches and I am a little worried about consistency. I will have to investigate more.
Updates:
- 2016-03-10: I added an article on the methodology of benchmarking.