Slow file copy over ethernet (RPi4 8GB)


I was testing network speed on my Raspberry Pi 4 8GB and there was something strange happening (maybe it is just because I use Raspbian but I was curious if someone can confirm/deny it on their Arch install).

iperf3 gives me solid 1Gbps speed

[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.09 GBytes   939 Mbits/sec    0             sender
[  5]   0.00-10.00  sec  1.09 GBytes   936 Mbits/sec                  receiver

But when I copy a big file (1GB and then 4GB) I get only about 40 MB/s. It doesn’t matter if it is on external SSD or directly in /tmp/ (which is mounted as tmpfs on both devices).

~ >>> scp pi:/tmp/bigfile2 /tmp/
bigfile2               100% 1000MB  40.7MB/s   00:24

the same with rsync

~ >>> rsync -chavP --stats pi:/tmp/bigfile2 /tmp/
receiving incremental file list
          1.05G 100%   40.93MB/s    0:00:24 (xfr#1, to-chk=0/1)

Number of files: 1 (reg: 1)
Number of created files: 1 (reg: 1)
Number of deleted files: 0
Number of regular files transferred: 1
Total file size: 1.05G bytes
Total transferred file size: 1.05G bytes
Literal data: 1.05G bytes
Matched data: 0 bytes
File list size: 67
File list generation time: 6.006 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 43
Total bytes received: 1.05G

sent 43 bytes  received 1.05G bytes  34.39M bytes/sec
total size is 1.05G  speedup is 1.00

The same gives me ~120 MB/s on my spared laptop on the same ethernet cable.

Could this be something hardware or software related?

That is pretty dunb question.

The main culprit seams to be ssh itself specificaly the encrytion.
With default options its 40MBps max. and the cpu is at 100% (single thread).
With scp -c aes128-crt it was pushing 49MBps.
Then I configured samba which gave me slightly above 60MBps - which is pretty good since I have no idea how to properly setup samba.