Maximum performance out of the Raspberry Pi 4 with an SSD drive

in STEMGeeks3 months ago

image.png

In my opinion, the biggest drawback of the Raspberry Pi is the extremely slow SD bus. This is the result of a single chip computer with everything like the USB and Ethernet all running on the same bus.

The Raspberry Pi 4 greatly improves the SD bus, but SD cards are still insanely slow for random IO and interactive usage. The type of SD card also can greatly impact the performance with only one card performing well.

The Raspberry Pi 3 and 4 can boot directly off SSD and can dramatically improve the performance of your Raspberry Pi. In fact, the performance can be as much as 50 times as fast as an SD card.

Below you will see a comparison of the Samsung EVO+ 32GB SD card, the best SD card you can use for a Raspberry Pi and a Samsung 850 EVO, a high-quality SATA SSD drive.

The first test will be Max Sequential IO and will reflect the maximum performance you can reach on the device. It is important to make sure you are running the SSD drive in UASP mode as this will result in roughly 50% more performance.

SD Max Sequential IO

/dev/mmcblk0:
Timing cached reads: 1774 MB in 2.00 seconds = 886.89 MB/sec
Timing buffered disk reads: 132 MB in 3.01 seconds = 43.90 MB/sec

SSD Max Sequential IO

/dev/sda:
Timing cached reads: 1726 MB in 2.00 seconds = 863.49 MB/sec
Timing buffered disk reads: 1096 MB in 3.00 seconds = 364.74 MB/sec


The SD card comes in at 43.90MB/s while the SSD drive comes in at 364.74 MB/s. This is an 800% improvement over the SD card, keep in mind most SD cards are far slower. On a Raspberry Pi 3+ and lower the performance will be significantly worse as the SD bus is considerably slower.

This is an impressive improvement, but Random IO will be even more impressive and more reflective in the time of load most applications will require.


SD Random IO

Run status group 0 (all jobs):
READ: bw=2636KiB/s (2699kB/s), 2636KiB/s-2636KiB/s (2699kB/s-2699kB/s), io=375MiB (393MB), run=145640-145640msec
WRITE: bw=879KiB/s (900kB/s), 879KiB/s-879KiB/s (900kB/s-900kB/s), io=125MiB (131MB), run=145640-145640msec

Disk stats (read/write):
mmcblk0: ios=94861/31905, merge=817/106, ticks=7571517/1658002, in_queue=398620, util=94.41%

SSD Random IO

Run status group 0 (all jobs):
READ: bw=64.0MiB/s (68.1MB/s), 64.0MiB/s-64.0MiB/s (68.1MB/s-68.1MB/s), io=375MiB (393MB), run=5770-5770msec
WRITE: bw=21.7MiB/s (22.7MB/s), 21.7MiB/s-21.7MiB/s (22.7MB/s-22.7MB/s), io=125MiB (131MB), run=5770-5770msec

Disk stats (read/write):
sda: ios=93754/31258, merge=7/1, ticks=20034/5610, in_queue=23060, util=98.28%


Here you can see the SD card has 27MB/s read performance and 0.9 MB/s write. The SSD drive has 68.1 MB/s read performance and 22.7 MB/s write performance. While the random read performance of the SSD drive is only 250% faster, the random write performance is 2500% faster.

As with most disk devices, the write performance is significantly slower than reading. This is reflected in all of the above tests.

If you are using a Raspberry Pi as a desktop or using it for anything that puts any load on the SD bus, an SSD drive will be a huge performance improvement.

Cover Image


Securely chat with me on Keybase

Why you should vote me as witness

Sort:  

I love your Raspberry Pi series.
I got my first two Pi’s recently and am now starting to understand why people love them so much.

Pi is a lot of fun as they are so cheap and so much you can do with them. It also brings out the creativity in people.

I should put an index for my Pi series like I do with my Python series, next post I'll try setting that up.

I need to design a SSD bracket for the VESA mounton my touchscreen case. I have a USB3 to SATA cord already, and it works fine. And smaller SSDs aren't too expensive these days.

SSD are real cheap now until you get to 1TB. Make sure you can do USB 3 and UASP. Will cover this in next post or two.

This is great because I have a lot of 60Gb SSDs lying around from my mining days.

What is the UASP?

It is a more optimized usb mass storage protocol. Not all usb can do it. Will likely be posting about it tomorrow.

You can read more here.

I run my Pi4 8GB with an OCZ Vertex 3 120GB, it was laying in the drawer so a complete no brainer really, but I just store the block-chain files on there, overall performance isn't a great concern for me.

https://hive.blog/stemgeeks/@scalextrix/my-new-raspberry-pi-4b-8gb

Check my post on how to verify if you are running in UASP mode, you can see over 50% performance instantly just by using the correct SATA to USB 3 cable ($9).

What os do you use on your raspberry?

I use Raspberry Pi OS 32 Bit.

64 Bit is available, as is Ubuntu 20.04 64 Bit, but GPU acceleration is not supported yet as well as some other issues. I recommend using Raspberry Pi OS 32 Bit for a while until 64 Bit support is more stable.

If you are just tinkering, by all means, use the 64 Bit version or Ubuntu. It is fine for most things as long as you are not running X Windows or gaming.

I just want to run some python scripts? Perhaps 32 bits is enough...

By the way, do you think 2 go for the Ram is enough?

Plenty