3

I'm having an odd problem with the ethernet connection on my Pi. All examples below use wired connections.

  • Copy file from laptop to Pi sd card (ssh,ftp,samba): 50-60 kb/s

  • Copy file from Pi sd card to Laptop (same): ~ 2 mb/s

  • Copy file from Pi sd card to Pi ntfs usb: ~ 4 mb/s

When I copy from Pi sd to Pi usb the CPU maxes out with the ntfs mount process. (as expected) When copying from the laptop to Pi, the CPU doesn't get above 10%. So CPU and disk speed can't be blamed. And the ethernet connection itself seems okay since I can get 2 mb/s on a read.

Does anyone have any idea what might cause my ethernet to be so slow when writing to the Pi?

  • SD cards can indeed be surprisingly slow - especially if the file system block size is a poor match for the actual flash memory block size, or worse if the alignment mismatches. – Chris Stratton Feb 14 '15 at 22:44
  • Please can you benchmark the SD card in question using a tool such as Crystal Disk Mark or similar (portableapps.com/apps/utilities/crystaldiskmark_portable). It is common for flash devices to have good read performance and poor write performance. – Drew Anderson Feb 18 '15 at 11:22
  • Also, if you can benchmark the network adapter using a linux tool such as iperf, this will transfer data over the network interface without using storage and will confirm any performance issues with the ethernet. – Drew Anderson Feb 18 '15 at 11:23
3

On the pi, the USB and Ethernet share that same data bus. When copying from SD to USB you allow the USB to use the entire bus. However when copying from laptop to pi via Ethernet. The bus's bandwith mist be split between the USB and Ethernet. This causes a bottle neck in the IO and not the CPU.

  • While I agree with what you are saying about the various limitations, this doesn't explain why the pi is often so slow -- e.g., the figures in the question. – goldilocks Feb 9 '15 at 6:48
0

Essentially, the Pi CPU hands data a packet at a time to the GPU which has a short pipe-line to it's (single) USB port. Data is then handed off from the GPU to the Pi board dual/quad USB + Ethernet chip.

At a guess, every time you have to switch between a chip USB port and chip Ethernet port the Pi GPU pipe-line has to be 'flushed' and a new 'port' selected before data transfer can resume.

Coupled to this is the fact that all this port switching leads to data loss .. (as you will soon discover if you try to use a USB mouse/keyboard at the same time as USB disk i/o), since both USB and Ethernet protocol supports 'retransmit on error' there will be another huge overhead as packets are resent ....

In short, if you want max USB speed out of the Pi, stick to the model A .. OR transfer 'big' blocks one at a time (eg do N Mb in followed by N Mb out) so as to minimise switching overhead)

  • USB operates with packets, not lone bytes. – Chris Stratton Feb 14 '15 at 22:43

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.