What kind of performance can I expect from a Raspberry Pi 2 as a NAS with 2 External hard-drives as a software RAID-1?
I know that the Ethernet runs as a USB device so they all (Ethernet and 2 external HDDs) share a single USB bus.
I already have a setup like this and am wondering if I'm seeing the full potential when I run tests.
I have achieved the following through tests:
Raspberry Pi 2 overclocked to “Medium” via
raspi-config, 2 x Seagate Expansion 3TBytes external hard-drives
Software RAID level 1 setup using
mdadm -Cv /dev/md1 -l1 -n2 /dev/sd[ab]2
File-system ext4 type created with:
mkfs /dev/md0 -t ext4
Performance test against a Desktop PC running Ubuntu 12.04, connected with wired network.
iperf, Raspberry Pi as server:
$ iperf -c raspberrypi -t30 [ ID] Interval Transfer Bandwidth [ 3] 0.0-30.0 sec 300 MBytes 83.8 Mbits/sec
Write onto software RAID file system using
ddon the Raspberry Pi
$ dd if=/dev/zero of=testfile6 bs=4M count=75 314572800 bytes (315 MB) copied, 17.2022 s, 18.3 MB/s
Copy from/to software RAID file system using dd on raspberry pi
$ dd if=testfile6 of=testfile7 bs=4M 314572800 bytes (315 MB) copied, 35.2339 s, 8.9 MB/s
I then exported the RAID drive as a NFS and made write tests on the Desktop PC after having mounted the NFS. Again, using
$ dd if=/dev/zero of=testfile8 bs=4M count=75 314572800 bytes (315 MB) copied, 50,9384 s, 6,2 MB/s
And a read test using
$ dd if=testfile9 of=/dev/null bs=4M 314572800 bytes (315 MB) copied, 57,3728 s, 5,5 MB/s
I guess that writing to the software RAID over NFS require writing data to both external HDDs and an equal bandwidth share goes to the Ethernet controller.
However, if I can write directly to the software RAID with a speed of 18.3 MB/s which is the speed of writing all data twice, then I would expect an actual bandwidth of double that, i.e. 36.6 MB/s.
This bandwidth should be divided by 3 when data comes from the Ethernet controller meaning I should be able to transfer at (36.6 / 3) MB/s = 12.2 MB/s.
iperf test showed that the Ethernet controller is able to transfer at 83.8 MBits/s = 10.4 MB/s so I guess this is the bottleneck, but then, why do I only get around 6 MB/s?