5

I've setup a file server using my new PI, and I'm very disappointed about the performance. I have attached by USB 2.0 2.5" HDD with an USB hub, formatted using NTFS, and mounted automatically. I had installed samba server and setup the share.

I can download/upload files only at about 700 KB/s (peak), with an average to 300 KB/s.

At first, I suspected about HDD link performance. Indeed I performed the test:

pi@raspmedia ~ $ sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads:  60 MB in  3.05 seconds =  19.69 MB/sec

Indeed, the bottleneck is not the HDD link. Therefore it could be the network link? Lets test using iperf:

pi@raspmedia ~ $ iperf -s -p 10000
------------------------------------------------------------
Server listening on TCP port 10000
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
[  4] local 192.168.1.103 port 10000 connected with 192.168.1.102 port 56077
[ ID] Interval       Transfer     Bandwidth
[  4]  0.0-10.8 sec  2.88 MBytes  2.24 Mbits/sec
[  5] local 192.168.1.103 port 10000 connected with 192.168.1.102 port 56080
[  5]  0.0-95.6 sec  23.4 MBytes  2.05 Mbits/sec

That's it! It seems that the bottleneck is the WiFi network. But... wait! Here is the wifi statistics:

pi@raspmedia ~ $ sudo iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: XX:XX:XX:XX:XX:XX
                    ESSID:"XXXXXXXXXXXXXXX"
                    Protocol:IEEE 802.11bgn
                    Mode:Master
                    Frequency:2.437 GHz (Channel 6)
                    Encryption key:on
                    Bit Rates:144 Mb/s
                    Extra:rsn_ie=30140100000fac040100000fac040100000fac020c00
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    Quality=96/100  Signal level=44/100

Has you can see

  • Bit Rates:144 Mb/s
  • Quality=96/100 Signal level=44/100

What's3 wrong with my Wifi? It is the signal level too low? Can anyone explain me how the above statistics affect network performance?

  • I guess the obvious test WRT signal strength would be to try this with the pi and third party right next to the router. – goldilocks Jun 28 '15 at 13:31
  • For comparison, with RPi2B wifi going to RPi2B wired, I get 45.7 Mbps using iperf. With RPi2B wifi going to RPi2B wifi, I get 25.0 Mbps. All RPi are in the same room as the wifi router. You didn't mention how the client is connected. – bobstro Jun 28 '15 at 21:07
  • Did you progress on the topic? – Huygens Jul 7 '15 at 21:06
4

You have an average of 300 KB/s using Samba, this translates to an average of 2,45 Mb/s which is in the same range of speed as what you measured with iperf.

So even though, you could have USB bandwidth competition between you WiFi dongle and the USB disk, this does not seem to be the case.

Your WiFi dongle is reporting good signal quality (e.g. low interference) but rather weak signal (44/100) which could mean you are far away from your router. This weak signal is probably the reason why you don't have a better throughput than 2.5Mb/s. Could you try to put your Raspberry Pi closer to the router/wifi access point?

In addition, you should know that if your client (the computer connected to samba or the other end of iperf) is also on the WiFi, the bandwidth might be limited by the WiFi of your client computer. What is the quality/strength of your client computer?

Note: the 144Mb/s given by your interface is the raw theoretical speed of the WiFi connection with perfect quality and maximum signal strength. But you still might get lower throughput in practice due to overhead of the packets encoding, packet loss, and most importantly to the fact that you are not the only one on your wifi. Only 1 WiFi user can communicate at one time (unless you have a 802.11ac MU-MIMO capable router and device, which is yet still extremely unlikely): this means that if you have 2 computers on your WiFi and they are trying to exchange a file, you get approximately half the bandwidth because when a bunch of packet are transmitted from the server to the WiFi access point (e.g. router), nothing is transmitted between the WiFi Access point and the client. And if you have a smartphone, tablet other computers on the same WiFi, they might steal some of your bandwidth during those tests.

My strong recommendation is: use a Ethernet cable between the Raspberry Pi and the router or WiFi access point.

  • 1
    It was the Wifi signal level. – Luca Jul 13 '15 at 18:22
3

There are a couple of things here.

In the first place, hdparm measures the raw performance of your hard drive. Going through a USB 2 connection, this is about what you would expect. But you mention the hard drive has been formatted using NTFS. Access to this filesystem can sometimes go really slow on Ubuntu/Debian. There is a good answer here https://superuser.com/questions/613869/ntfs-write-speed-really-slow-15mb-s-on-ubuntu that may help you to tweak access speed.

On the other hand, on the RP you are sharing a single USB 2 hub to connect both the WiFi dongle and the hard drive. It could very well be that HD operation is interfering with WiFi data rates. You can check if this is the problem by exporting files from the RP's SD cards with the USB HD disconnected. Please note the SD card will have better read speed than write - this is expected behavior.

  • Thanks, big_writes helped me to speed up write from 700 KB/s up to 4 MB/s – Marco Medrano Jul 18 '17 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.