HankB
Posts: 92
Joined: Fri Jan 01, 2016 2:45 pm

microSD vs. USB flash vs. SSD

Thu Dec 07, 2017 6:23 pm

Edit: Done! I think. ;)

I've been exploring these three recently in the desire to get the best possible performance out of a Raspberry Pi 3 Model B. I got it to boot directly from USB so the question I wanted to answer was whether I'd get better performance using a microSD card or USB flash drive. I had an unused SSD so I threw that into the mix as well.

The devices I tested are Test procedure involved three stages:
  • Install Raspbian Stretch (2017-07-05) to the media from a PC running Linux and using the 'cat' command. I purposely chose an older release so that the next two steps would have more packages to update/install. It turned out that this release requires 138 packages to make current. I also enabled WiFi and SSH for headless operation. Subsequent tests were performed by SSHing into the RPi and running the tests. A typical command and result for loading the image:

    Code: Select all

    root@yggdrasil:/home/hbarta/Downloads# time cat 2017-09-07-raspbian-stretch.img >/dev/mmcblk0
    
    real	3m29.398s
    user	0m0.000s
    sys	0m3.004s
    root@yggdrasil:/home/hbarta/Downloads# 
    
  • Update available packages. A typical command and result would look like

    Code: Select all

    pi@raspberrypi:~ $ time sudo apt update
    Get:1 http://mirrordirector.raspbian.org/raspbian stretch InRelease [15.0 kB]         
    Get:2 http://archive.raspberrypi.org/debian stretch InRelease [25.3 kB]               
    Get:3 http://mirrordirector.raspbian.org/raspbian stretch/main armhf Packages [11.7 MB]  
    Get:4 http://archive.raspberrypi.org/debian stretch/main armhf Packages [127 kB]         
    Get:5 http://archive.raspberrypi.org/debian stretch/ui armhf Packages [27.7 kB]                                  
    Get:6 http://mirrordirector.raspbian.org/raspbian stretch/non-free armhf Packages [95.2 kB]                                                                                     
    Fetched 11.9 MB in 18s (657 kB/s)                                                                                                                                               
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    138 packages can be upgraded. Run 'apt list --upgradable' to see them.
    
    real	0m23.790s
    user	0m12.450s
    sys	0m1.370s
    pi@raspberrypi:~ $ 
    
  • The last step was to time the update process

    Code: Select all

    pi@raspberrypi:~ $ time sudo apt -y upgrade
    Reading package lists... Done
    .
    .
    .
    Processing triggers for initramfs-tools (0.130) ...
    
    real	14m36.445s
    user	4m53.540s
    sys	1m6.350s
    pi@raspberrypi:~ $ 
    
Initially I performed the tests using WiFi. Before I tested the SSD it occurred to me that WiFi might be introducing unwanted variability in the results - more than WiFi anyway. I also did not repeat the tests multiple times. The statistical basis of my results are a bit shaky as a result. Nevertheless, I thought it would be interesting to share.

(At this point I wish there is a decent way to format a table in a forum post but I'm unaware of a way to do that.) I'll do the best I can with character spacing and format as 'code' to get uniform character width.
I'm going to report elapsed time also as that's what is of interest to me.

Code: Select all

                      load             update        upgrade       
Sandisk 16GB  USB   3m48.458s         0m23.790s        14m36.445s
Samsung 32GB USB    3m12.206s         0m19.580s        18m37.994s
Samsung 32GB SD     3m34.290          0m18.252s        11m50.542s
Samsung SD (Eth)                      0m18.360s        26m6.400s
Crucial SSD         0m12.062s         0m21.576s         8m19.682s
My conclusions...
SD vs. USB seems not to be a big difference. I was surprised that the SD actually performed the upgrade faster than both USB flash drives. The SSD is significantly faster.

Flash based devices get faster with bigger capacity as there are more chips to distribute operations over. That could easily explain the difference between 32 AND 16GB Devices. It also contributes to the speed in the SSD.

The Pi does not support USB 3. However USB 3 devices are faster and will more fully utilize the throughput available on a USB 2 connection. Unfortunately I have had poor luck using USB 3 hubs with the Raspberry Pi.

For the time being I'll continue to use the SSD with this Pi 3B (at least until I need it for another project.) In that situation I'll probably switch to the microSD card as it seemed to be a bit faster.

Another edit: Another question I have is which device will be most durable between SD and USB. The controller in the SSD employs wear leveling algorithms to distribute usage among the blocks so when the OS continually writes to the same location, the data actually goes to different physical locations in the disk. Some better SD and USB devices may do this too. I don't know if the devices I selected do this. Also the SD and USB devices are not designed for the kind of duty they would see as a system drive in a PC and (coupled with price pressure) dictates that less durable ICs will be used in their manufacture.

Time will tell.

User avatar
HawaiianPi
Posts: 1397
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: microSD vs. USB flash vs. SSD

Thu Dec 07, 2017 7:49 pm

Note that there is a distinction between Samsung EVO+ and EVO "Plus" cards, and apparently the newer EVO Plus version is slower on the Pi, according to a recent thread located elsewhere on the forums (I have a new EVO Plus, but have not been able to test it yet). The older EVO+ was the fastest card I had tested on the Pi due to its significantly better random I/O performance (an area where SD cards and USB flash drive suffer, but SSD excels).

The problem with SD cards and USB flash drives is that they have simple controllers and are designed for simple I/O (reading or writing one file at a time). This is why, for example, copying a single 2GB file is much faster than 2GB worth of small files in a folder, or multiple folders with 2GB of small files total. Complex I/O tends to crush the performance of SD cards and USB flash drives.

SSD drives, on the other hand, are designed to be computer OS drives, so they have much more powerful processors and handle complex I/O much better. They also have other features designed not only to improve performance, but also to improve lifespan, reliability and data integrity. So an SSD will not only perform better, it should also last much longer and will be far less likely to lose or corrupt data.

There used to be a large price discrepancy between simple USB flash devices and SSD, but the popularity of SSD has closed that gap significantly, and in larger sizes an SSD may even cost less than an SD card.

I have a 128GB SSD on my Pi3 and I have been very happy with the resulting performance.

Image

The reason why you have had trouble with USB 3.0 hubs is that some of them (usually the cheaper ones) are not hardware hub devices and instead rely on software to perform some of the functions normally done by hardware. This requires the OS to have that software, and in general those devices are designed for Windows.

I have a couple of small USB 3.0 hubs on my desk that I tried on my Pi3. One of them worked fine, the other not only didn't function, it also shut down the Pi's own USB ports and networking, which did not return to functional status when I unplugged the hub, so I was forced to pull the power to reboot the system. After that experience I have pretty much stuck to USB 2.0 hubs on my Pi computers (when needed).
My password is the last 8 digits of Pi.

User avatar
Imperf3kt
Posts: 355
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: microSD vs. USB flash vs. SSD

Thu Dec 07, 2017 8:08 pm

I thought flash memory got slower, the larger it gets?

Just look at those 1Tb SD cards, they're painfully slow.
Pi3b - 'normal use' temperature (25% CPU load) 76℃, ambient 21℃

User avatar
HawaiianPi
Posts: 1397
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: microSD vs. USB flash vs. SSD

Thu Dec 07, 2017 10:51 pm

Imperf3kt wrote:
Thu Dec 07, 2017 8:08 pm
I thought flash memory got slower, the larger it gets?

Just look at those 1Tb SD cards, they're painfully slow.
There are no true 1TB SD cards. There have been prototypes demonstrated by Sandisk and Western Digital, but I have not seen those for sale yet. 1TB cards from ebay or other China sellers are all fakes.

And bigger is faster applies more to SSD than cheaper flash devices, but it is true for some SD cards. Going from 16 to 32 to 64 with Samsung EVO+ cards yields faster performance with the larger sizes. Not sure about 128 or 256GB because the ones I bought were fake and I returned them. With my Silicon Power cards I get the same performance with 16 & 64GB.

Even with SSD there is a point where the performance increase levels off (usually at 256 or 512GB, depending on the type of memory).
My password is the last 8 digits of Pi.

Heater
Posts: 8089
Joined: Tue Jul 17, 2012 3:02 pm

Re: microSD vs. USB flash vs. SSD

Fri Dec 08, 2017 6:56 am

No, they are real I tell you.

You can get 1TB SD cards on ebay now. Only 1 dollar!

https://www.ebay.com/itm/1TB-micro-SD-S ... Sw5dlZ9pPB

It's a bit odd though. Because a Sandisk 32GB Extreme Pro costs 100 Euro in the local computer store round here:

https://www.verkkokauppa.com/fi/product ... istikortti

And a Hewlett Packard Enterprise 32GB microSD Enterprise Mainstream Flash Media Kit SD card cost 138 Euro:

https://www.verkkokauppa.com/fi/product ... -Kit-muist

User avatar
HawaiianPi
Posts: 1397
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: microSD vs. USB flash vs. SSD

Fri Dec 08, 2017 8:22 am

Heater wrote:
Fri Dec 08, 2017 6:56 am
No, they are real I tell you.

You can get 1TB SD cards on ebay now. Only 1 dollar!

https://www.ebay.com/itm/1TB-micro-SD-S ... Sw5dlZ9pPB
Wow, thanks Heater. I'm gonna get 10 of those and a micro-SD RAID card and throw away my puny 128GB SSD drive! Image

It looks like they found at least 2 gullible people (there are 2 negative reviews). :roll:
My password is the last 8 digits of Pi.

User avatar
Imperf3kt
Posts: 355
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: microSD vs. USB flash vs. SSD

Fri Dec 08, 2017 9:07 am

So when do the 1Pb SD cards come out?
Pi3b - 'normal use' temperature (25% CPU load) 76℃, ambient 21℃

jahboater
Posts: 1926
Joined: Wed Feb 04, 2015 6:38 pm

Re: microSD vs. USB flash vs. SSD

Fri Dec 08, 2017 10:32 am

HawaiianPi wrote:
Thu Dec 07, 2017 7:49 pm
Note that there is a distinction between Samsung EVO+ and EVO "Plus" cards, and apparently the newer EVO Plus version is slower on the Pi, according to a recent thread located elsewhere on the forums (I have a new EVO Plus, but have not been able to test it yet). The older EVO+ was the fastest card I had tested on the Pi due to its significantly better random I/O performance (an area where SD cards and USB flash drive suffer, but SSD excels).
These are popular and highly regarded SD cards, so I would be very interested in any benchmark figures you might have for the new ones.

Your comment that the larger Samsung EVO cards are faster is interesting.

They seem to be sold with a minimum size now of 32GB.
https://www.amazon.co.uk/Samsung-Memory ... g+evo+plus

fanoush
Posts: 260
Joined: Mon Feb 27, 2012 2:37 pm

Re: microSD vs. USB flash vs. SSD

Fri Dec 08, 2017 2:14 pm

Heater wrote:
Fri Dec 08, 2017 6:56 am
No, they are real I tell you.
You can get 1TB SD cards on ebay now. Only 1 dollar!
Joking aside I bought couple of similar 8 and 4GB fake cards just to hold bootcode.bin to boot from something else. Those fake cards have enough flash memory to hold FAT table and few files. Typically first 80-100MB is usable so if one creates small enough partition it works with no errors. And the price of such card is free since I get ebay money back because the card is fake capacity and I can prove it. I first used real small capacity cards (128,256, 512MB) but often they don't boot at all in the pi for some reason. So I got in fact better success with booting bootcode.bin from these fake cards than small capacity real cards.

hommar
Posts: 92
Joined: Sat Mar 25, 2017 1:55 pm
Location: Russia, Yekaterinburg

Re: microSD vs. USB flash vs. SSD

Fri Dec 08, 2017 4:21 pm

jahboater wrote:
Fri Dec 08, 2017 10:32 am
HawaiianPi wrote:
Thu Dec 07, 2017 7:49 pm
Note that there is a distinction between Samsung EVO+ and EVO "Plus" cards, and apparently the newer EVO Plus version is slower on the Pi
These are popular and highly regarded SD cards, so I would be very interested in any benchmark figures you might have for the new ones.
I have 32Gb "EVO+" and 32Gb "EVO Plus". What you want see?
My tests:
EVO Plus faster for write (19.3Mb/s and 15.9Mb/s for "+" w/o overclock)
EVO+ faster for overclock (100MHz and max 80MHz for "Plus")
and "+" is faster for read (36,2Mb/s and 26,8Mb/s for "Plus" with max overclock)

PS on both SDs I make partition:
/dev/mmcblk0p3 33554432 62521343 28966912 13,8G 83 Linux
for test I run from USB and hot plug SDs
Last edited by hommar on Fri Dec 08, 2017 8:10 pm, edited 4 times in total.

jahboater
Posts: 1926
Joined: Wed Feb 04, 2015 6:38 pm

Re: microSD vs. USB flash vs. SSD

Fri Dec 08, 2017 5:15 pm

hommar wrote:
Fri Dec 08, 2017 4:21 pm
EVO Plus faster for write (20.7Mb/s and 17.5Mb/s for "+")
EVO+ faster for overclock (100MHz and max 80MHz for "Plus")
and "+" is faster for write (36,2Mb/s and 26,6Mb/s for "Plus") with max overclock
Interesting!
Perhaps OS boot time (easy to measure with: systemd-analyze)?
Random 4k reads are useful for OS performance.

hommar
Posts: 92
Joined: Sat Mar 25, 2017 1:55 pm
Location: Russia, Yekaterinburg

Re: microSD vs. USB flash vs. SSD

Fri Dec 08, 2017 8:10 pm

I retest SDs now, and I fix error on last line ("write"->"read")

hommar
Posts: 92
Joined: Sat Mar 25, 2017 1:55 pm
Location: Russia, Yekaterinburg

Re: microSD vs. USB flash vs. SSD

Sat Dec 09, 2017 10:49 am

New test: update 2017-03-02-raspbian-jessie.img
Toshiba Exceria: 12:34:32-13:16:11 = 41:39 (write 20Mb/s, read 26,7Mb/s can't overclock)
EVO+: 14:03:43-14:20:24 = 16:41 (100MHz)
EVO Plus: 14:58:39-15:20:08 = 21:29 (80MHz)

Return to “General discussion”

Who is online

Users browsing this forum: No registered users and 52 guests