very low performance tcp/rsh

Eugene Grosbein eugen at grosbein.net
Mon Apr 29 19:00:00 UTC 2019


30.04.2019 1:30, Wojciech Puchar wrote:

> i tried
> 
> rsh -l user localhost "cat /dev/zero" >/dev/null
> 
> got 300MB/s or machine that can do memcpy at 10GB/s (with 1GB blocks - no cache) single threaded.
> 
> what limits the performance

memcpy() runs in user space while reading (pseudo) device does multiple system calls
with context switches and copying data from kernel to userland (and back while sending to the net).

Also, zero(4) device has additional and significant overhead because it needs
to clear many memory pages and it can make heavy load on VM subsystem.

Also, rsh is not optimized for multi-GB/s speeds.

If you want to measure single-threaded TCP performance,
use mdconfig to create memory "disk", put some big file there (2GB should be enought)
and run stock ftpd to send big file. Our ftpd uses sendfile() system call
that makes kernel read data from file and put it directly to TCP socket
without any kind of extra data copying and without extra context switches.





More information about the freebsd-hackers mailing list