First, i don't see any question in your post... But i'll assume that your question is "Why my transfert rate isn't always 1 GiB/s ?".
Theorical VS real network speed.
When a link is announced to support 100MiB/s or 10GiB/s, it's a //raw// transfert rate.
Protocols are using bandwidth
If you use TCP (which is the case with HTTP/SFTP/SCP/FTP...), the real bandwidth will be: 1500 (commonly used MTU) - sizeof TCP header - sizeof Ethernet header - sizeoef protocols metadata
:
- Ethernet header: ~30 bytes.
- TCP header: ~20 bytes.
So, for 1500 bytes, you already loose 50 bytes, which is 3%.
And this is only for RAW transfert over TCP. Using HTTP/SFTP/FTP imply using even more metadata (the one related to protocol: headers on HTTP, command channel on FTP, ) that are using bandwidth.
This was for the "theorical VS practical" bandwidth.
Network card: "Hey, i need data", Hard drive disk; "Wait a minute bro".
Now, there's another point that may drastically slow down your transfert: the fact you are transferring files.
As long as you transfer files, then you're depending of your filesystem + mass storage performances.
For example, Transferring 15GiB of small files will be longer than transferring a 15GiB file because your OS have to:
- List files
- Open file
- Read file content
- Push it throught socket.
- Close file.
- Open next file ...
Your files are stored using filesystem on hard drive disk, SSD, USB flash, etc.. so you have to take into account:
- The overhead introduced by your filesystem.
- The overhead introduced by your real, hardware device.
Benchmarking network
If you want to make sure that your network is really working at full speed, i would suggest doing the following benchmark, using 2 machines on the same lan:
On machine #1
On machine #2
dd if=/dev/zero bs=1M count=1024 | nc <machine #1> 10000
It will:
- On machine #1, listen for incoming packets on port 10000 and return you the time passed to receive data.
- On machine #2, read 1GiB zeros from
/dev/zero
(almost instant) and push it to machine #2 throught network.
If, using this benchmark, you reach your link maximal bandwidth minus ~ 3%, then your link is working full speed.
Else, there's a problem on the link you should investigate.
Getting more more more moarrrr bytes/seconds
To increase transfert speed, you may:
- If you have the total control on your network, you may increase the MTU so that each packet have more space dedicated to payload.
- Study the better filesystem.
- Think about using ramdisk instead of real hard drive.
- Use an application protocol that uses few metadata (
nc
> *. HTTP
is not that bad in most case, avoid FTP
because of the overhead induced by opening/closing new TCP port for file transfert, avoid SFTP
because of the overhead induced by crypto, etc... )
Edited after exchanges with OP in comment
Wifi VS RJ45
Wifi isn't good in big transfert. I can't explain, but i often noticed that performance are poor, even poorer than using a hop host internet to achieve the transfert.
It probably depends on Wifi used (a, b, c, n), on wifi setup (access point, channel used) and in neighborhood (everybody on the same channel?).
To get the best, use RJ45 !
Well, I'm going to reinstall my ubuntu server from scratch, and see if something change... It's a bit radical but that's the only way I see to find what's the matter. – Xalares – 2019-10-25T10:28:50.310
"so nothing changed with sftp" - What about FTP? + Do not post important information in comment. Edit it into your question + "It's not because of CPU performances" - How did you check? – Martin Prikryl – 2019-10-25T11:35:51.043