netcat throughput low but iperf high
The scale sound about right for NetCat not supporting TCP Windowing. If you do a tcpdump on the interface while the two benchmarks are running I'm guessing you'll see this pattern for NC:
- Packet ->
- <- Ack
- Packet ->
- <- Ack
- Packet ->
- <- Ack
- Packet ->
- <- Ack
And this pattern for IPerf:
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- <- Ack
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- <- Ack
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- Packet ->
- <- Ack
By Windowing TCP segments you can get much higher throughputs since you don't have to wait for the Ack after every packet, only after every segment.
It isn't netcat
. With iperf
I get
[ 3] local 192.168.1.201 port 55610 connected with 192.168.1.200 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 394 MBytes 39.4 MBytes/sec
With nc -l -p 1852 > /dev/null
and cat /dev/zero | pv -r | nc 192.168.1.200 1852
I get
[ 34MB/s]
(Fluctuates between 30 and 60.)
What data are you feeding netcat
?