not_the_messiah
Posts: 14
Joined: Sat Mar 05, 2016 10:36 pm

RPI4 Poor Network Speeds

Sat Aug 31, 2019 4:20 pm

Hi Everyone,

I have recently bought and configured my RPI4 to be a NAS. I have two 4tb drives connected to the two USB3 ports in a RAID1 configuration and the pi is connected to my network via ethernet. When writing dd output to the RAID array, I get write speeds of about 140MB/s, which is fine for my uses. However, when trying to access the RAID array via SMB/NFS and running the same dd commands that gave me 140MB/s, I am only achieving 4MB/s, which is super poor.

Previously I have an HP Microsever where the Pi is now, connected to the same switch with the same ethernet cable and the performance was much better over the network.

A quick read on here suggests that the switch might be an issue (I have this one: https://www.amazon.co.uk/gp/product/B00 ... UTF8&psc=1), but given it worked fine with my previous setup, seems unlikely (or does it?).

Cheers

Tim

User avatar
DougieLawson
Posts: 36302
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPI4 Poor Network Speeds

Sat Aug 31, 2019 5:01 pm

Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

not_the_messiah
Posts: 14
Joined: Sat Mar 05, 2016 10:36 pm

Re: RPI4 Poor Network Speeds

Sat Aug 31, 2019 5:13 pm

Thanks, but I don't see how that is relevant, given it's a Pi3B+ and their issue is access speed via a VPN from the WAN?

User avatar
DougieLawson
Posts: 36302
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: RPI4 Poor Network Speeds

Sat Aug 31, 2019 5:15 pm

Try doing the flow control stuff. It's an experiment you can try that won't hurt even if it doesn't work.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
B.Goode
Posts: 8820
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: RPI4 Poor Network Speeds

Sat Aug 31, 2019 5:22 pm

not_the_messiah wrote:
Sat Aug 31, 2019 4:20 pm

A quick read on here suggests that the switch might be an issue (I have this one: https://www.amazon.co.uk/gp/product/B00 ... UTF8&psc=1), but given it worked fine with my previous setup, seems unlikely (or does it?).


That's one of several possible bottlenecks. Others include CPU cycles to process the NAS traffic, or throughput of some other interface.

To try to narrow it down, perhaps run a test of just the network performance against your RPi via the network infrastructure it is using. The iperf3 tool might be a good choice for this.

Edit: and to add that this gives you a quick and focused test of any tweaks you make to the network infrastructure.

not_the_messiah
Posts: 14
Joined: Sat Mar 05, 2016 10:36 pm

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 12:03 pm

DougieLawson wrote:
Sat Aug 31, 2019 5:15 pm
Try doing the flow control stuff. It's an experiment you can try that won't hurt even if it doesn't work.
Ok, done (I think) - having trouble getting Flow Acceleration working (Asus Router), but I have CTF enabled. Resulted in a minor boost to about 5.4Mb/s, which is still way off what it should be!

not_the_messiah
Posts: 14
Joined: Sat Mar 05, 2016 10:36 pm

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 12:18 pm

B.Goode wrote:
Sat Aug 31, 2019 5:22 pm
To try to narrow it down, perhaps run a test of just the network performance against your RPi via the network infrastructure it is using. The iperf3 tool might be a good choice for this.
Thanks for the pointer. I have run it from another RPi (ethernet) and my Win10 laptop (WiFi) with results along the lines of:

Code: Select all

[  4] local 192.168.1.55 port 48332 connected to 192.168.1.190 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  5.25 MBytes  5.25 MBytes/sec    0    262 KBytes
[  4]   1.00-2.00   sec  5.60 MBytes  5.58 MBytes/sec    0    520 KBytes
[  4]   2.00-3.00   sec  5.67 MBytes  5.67 MBytes/sec    0    785 KBytes
[  4]   3.00-4.00   sec  5.70 MBytes  5.70 MBytes/sec    0   1.02 MBytes
[  4]   4.00-5.00   sec  5.74 MBytes  5.77 MBytes/sec    0   1.29 MBytes
[  4]   5.00-6.00   sec  5.24 MBytes  5.22 MBytes/sec    0   1.55 MBytes
[  4]   6.00-7.01   sec  5.36 MBytes  5.35 MBytes/sec    0   1.81 MBytes
[  4]   7.01-8.00   sec  5.11 MBytes  5.13 MBytes/sec    0   1.89 MBytes
[  4]   8.00-9.00   sec  5.34 MBytes  5.33 MBytes/sec    0   1.89 MBytes
[  4]   9.00-10.01  sec  5.44 MBytes  5.42 MBytes/sec    0   1.89 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.01  sec  54.5 MBytes  5.44 MBytes/sec    0             sender
[  4]   0.00-10.01  sec  53.7 MBytes  5.36 MBytes/sec                  receiver
I have also run it solely on the RPi4 itself with the following results:

Code: Select all

Connecting to host 192.168.1.190, port 5201
[  5] local 192.168.1.190 port 39734 connected to 192.168.1.190 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec   661 MBytes   661 MBytes/sec    0   1.19 MBytes
[  5]   1.00-2.00   sec   690 MBytes   690 MBytes/sec    0   1.19 MBytes
[  5]   2.00-3.00   sec   684 MBytes   684 MBytes/sec    0   1.19 MBytes
[  5]   3.00-4.00   sec   688 MBytes   688 MBytes/sec    0   1.31 MBytes
[  5]   4.00-5.00   sec   686 MBytes   686 MBytes/sec    0   1.31 MBytes
[  5]   5.00-6.00   sec   691 MBytes   691 MBytes/sec    0   1.31 MBytes
[  5]   6.00-7.00   sec   691 MBytes   691 MBytes/sec    0   1.31 MBytes
[  5]   7.00-8.00   sec   686 MBytes   686 MBytes/sec    0   1.31 MBytes
[  5]   8.00-9.00   sec   682 MBytes   682 MBytes/sec    0   1.31 MBytes
[  5]   9.00-10.00  sec   691 MBytes   691 MBytes/sec    0   1.31 MBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  6.69 GBytes   685 MBytes/sec    0             sender
[  5]   0.00-10.04  sec  6.68 GBytes   682 MBytes/sec                  receiver
Not sure what this tells me apart from the fact there's a network issue :)

Cheers

Tim

andrum99
Posts: 843
Joined: Fri Jul 20, 2012 2:41 pm

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 12:43 pm

Ethernet flow control may not be available as a setting you can change on the router - in this case it should always be enabled. What speed is the Pi 4 connecting at - is it coming up in gigabit mode? You can install ethtool to find out:

Code: Select all

sudo apt update
sudo apt install ethtool
sudo ethtool eth0
Then post the output here. Do you have a spare switch, or another router you can use as a switch? To use another router as a switch, simply connect one of the ethernet ports on the Asus router to a LAN port on the other router, and don't connect anything to the broadband port of the router you are using as a switch.

not_the_messiah
Posts: 14
Joined: Sat Mar 05, 2016 10:36 pm

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 1:01 pm

Thanks for the reply :)

Output from ethtool:

Code: Select all

Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Link partner advertised FEC modes: Not reported
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 1
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: gs
        Wake-on: d
        SecureOn password: 00:00:00:00:00:00
        Current message level: 0x00000007 (7)
                               drv probe link
        Link detected: yes
        
I do have a spare switch - older version of the one I linked to. I'll give that a try!

EDIT: Same behaviour with spare switch.

User avatar
mikronauts
Posts: 2726
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 2:27 pm

Make sure the drives are not using ntfs.
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

not_the_messiah
Posts: 14
Joined: Sat Mar 05, 2016 10:36 pm

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 2:45 pm

mikronauts wrote:
Sun Sep 01, 2019 2:27 pm
Make sure the drives are not using ntfs.
No, all drives are formatted as Ext4. But if the drive format was an issue, then the write speed from the Pi4 would also suffer, wouldn't it?

User avatar
mikronauts
Posts: 2726
Joined: Sat Jan 05, 2013 7:28 pm
Contact: Website

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 4:24 pm

Yes, but ntfs is one of the first things to check.

Check your wired network to make sure your pi is connected at 1000mbps.

Check samba tuning parameters, and make surd your switch supports jumbo frames.
not_the_messiah wrote:
Sun Sep 01, 2019 2:45 pm
mikronauts wrote:
Sun Sep 01, 2019 2:27 pm
Make sure the drives are not using ntfs.
No, all drives are formatted as Ext4. But if the drive format was an issue, then the write speed from the Pi4 would also suffer, wouldn't it?
http://Mikronauts.com - home of EZasPi, RoboPi, Pi Rtc Dio and Pi Jumper @Mikronauts on Twitter
Advanced Robotics, I/O expansion and prototyping boards for the Raspberry Pi

User avatar
B.Goode
Posts: 8820
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 4:29 pm

(after displaying comparative results from iperf... )
Not sure what this tells me apart from the fact there's a network issue



Isn't that quite significant in itself?

Sure, it doesn't tell you what to fix in the network infrastructure.

But isn't it Good News that it shows the Raspberry Pi network interface and Raspbian network implementation are not the bottleneck?

And since the poor cross-network results are in the same order of magnitude as the figure you got for cross-network access to the NAS, hopefully fixing your network infrastructure will at a stroke give you the performance you hope for from the NAS?

epoch1970
Posts: 3780
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 4:40 pm

“ethtool said in vain” wrote:Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
This is not a gigabit switch or the cable between the switch and the Pi 4 is not “cat. 5E”, “cat 6” or 7.
In consequence the Pi downgrades to fast Ethernet speed, 100Mbps, about 10MB/s max data transfer speed. You reported 5MB/s including a WiFi link, that seems commensurate.

Make sure the switch is capable of gigabit speeds and the cables too.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

not_the_messiah
Posts: 14
Joined: Sat Mar 05, 2016 10:36 pm

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 4:57 pm

epoch1970 wrote:
Sun Sep 01, 2019 4:40 pm
“ethtool said in vain” wrote:Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
This is not a gigabit switch or the cable between the switch and the Pi 4 is not “cat. 5E”, “cat 6” or 7.
In consequence the Pi downgrades to fast Ethernet speed, 100Mbps, about 10MB/s max data transfer speed. You reported 5MB/s including a WiFi link, that seems commensurate.

Make sure the switch is capable of gigabit speeds and the cables too.
Thanks for the reply. The switch is definitely gigabit - says so on it and it was operating at gigabit speeds when I had my microserver in situ. It's the same cable too (states cat.5E on it). I will get a Cat6/7 cable from somewhere and see if that makes a difference.

andrum99
Posts: 843
Joined: Fri Jul 20, 2012 2:41 pm

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 5:04 pm

Any speed tests must be done using wired network connections only. Speed tests done where either device is on wifi, or there is wifi in the path between them, are invalid since the wifi will cause a slowdown, no matter how fast the wifi device says it is connected.

It seems that the Pi 4 is auto-negotiating down to 100Mbps full duplex. Your switch supports flow control - this is implemented through pause frames, which ethtool reports it supports.

Can you confirm you are not using wifi anywhere between the Pi and the other machine? I would try any other cables that you have, and just to be sure, power the Pi and the switch down before trying a different cable.

not_the_messiah
Posts: 14
Joined: Sat Mar 05, 2016 10:36 pm

Re: RPI4 Poor Network Speeds

Sun Sep 01, 2019 6:00 pm

andrum99 wrote:
Sun Sep 01, 2019 5:04 pm
Any speed tests must be done using wired network connections only. Speed tests done where either device is on wifi, or there is wifi in the path between them, are invalid since the wifi will cause a slowdown, no matter how fast the wifi device says it is connected.

It seems that the Pi 4 is auto-negotiating down to 100Mbps full duplex. Your switch supports flow control - this is implemented through pause frames, which ethtool reports it supports.

Can you confirm you are not using wifi anywhere between the Pi and the other machine? I would try any other cables that you have, and just to be sure, power the Pi and the switch down before trying a different cable.
Hi. I performed tests over wired and wireless connections - all reported similar speeds. I'll dig out another 5e cable and give that a try.

Return to “Troubleshooting”