I've seen some odd data transfer rates when copying large files between a Windows 7 PC and a Pi, over an SMB share. Instead of a fairly constant speed, sometimes/usually I got a rate which varied between about 0.5 and 80 Mbps as a sawtooth with a periodicity of about 20 seconds. For an Ethernet connection instead of wifi, the transfer rate was always constant.
Any suggestions as to why it is happening? Is it a wifi "funny" (eg some sort of interference from a non-wifi source) or is the wifi adapter in the Pi intermittently behaving oddly? I realise that the Ethernet and wifi adapters in the Pi effectively go via the USB controller.
Background
----------------
I have a Window 7 PC and a Raspberry Pi 3B+.
The Win 7 was always connected to a TP Link 9980 router by Ethernet, at 1 Gbps speed (as shown by Task Manager | Networking). The router was not connected to ADSL/VDSL during the test - the phone cable was unplugged.
The Pi was connected either by Ethernet or Wifi, and the Wifi was either 2.4 GHz or 5 GHz.
There were no other wireless networks visible on Wifianalyzer app on an Android PC. I wasn't using a microwave oven (those sometimes put out a bit of 2.4 GHz shash).
A USB disk on the Pi was mounted as /home/pi/Videos and shared by Samba, and was accessible as a drive in Windows (net use r: \\win7\pi-share).
I measured file transfer read/write rates (a 1.3 GB file, with the transfer done as a copy/paste in Windows Explorer) between the Win 7 and the Pi using the various networking connections between the Pi and the router, always copying to/from the same SATA disc on the Windows PC.
The Pi and the router were about a foot apart, so signal strength was strong. And there were no other wifi networks.
Note that only *one* leg of the connection was wifi: the Windows 7 PC was always connected by Ethernet, to avoid wireless clashes between the two legs of the connection.
Results (for those who want the details!)
---------
Times (m:ss) for 1.32 GB file were:
Pi connected by Ethernet:
- 1:19 Win7 copies to Pi share (16.7 MB/sec, transfer rate about 160 Mbps, fairly constant))
- 1:17 Win7 copies from Pi share (17.1 MB/sec, transfer rate about 160 Mbps - fairly constant)
Pi connected by 2.4 GHz wifi
- Win 7 copies to Pi: 5:55 (sawtooth between 0.4 and 80 Mbps)
- Win 7 copies from Pi: 7:28 and 7:57 (two runs), transfer rate varies as sawtooth (about 20 second period) between 0.4 and 80 Mbps
Pi connected by 5 GHz wifi
- Win7 to Pi: 2:30 and 3:29 (first run was flat-out at about 90 Mbps, second run was sawtooth between 5 and 90 Mbps)
- Win7 from Pi: 2:30 and 4:27 (flat out at about 90 Mbps / sawtooth between
0.4 and 90 Mbps)So the Pi is capable, at best, of copying at about 90 Mbps, at a fairly constant rate, over 5 GHz wifi. But usually the transfer runs much lower, with just occasional peaks to about 90 Mbps. Over 2.4 GHz, I did not see any flat-out transfers and the speed varied between 0.4 Mbps and 80 Mbps, for 5 GHz some transfers were flat out and others varied between about 5 and 90 Mbps.
Conclusion
--------------
Not surprisingly, best and most consistent rates are achieved with an Ethernet connection. 5 GHz gives higher speeds and sometimes flat-out (predictable) transfer; 2.4 GHz is a lot slower because it always spends a proportion of the time running at well below the peak speed.
The reason I was testing it was to work out whether I could manage with wifi rather than Ethernet cable or Ethernet-over-mains (powerline) from the Pi (in one room) to the router and Win 7 PC on the other side of the wall in the neighbouring room. The Pi needs to be in one room because it is used for recording TV and that's where the aerial and satellite cables are; the other room is my study. Wifi is unreliable and could take ages to copy recordings to my Win 7 "server", so it will have to be powerline - or else a hole drilled at skirting board level in the living room wall which will not get SWMBO approval ;-)