esnet / iperf

iperf3: A TCP, UDP, and SCTP network bandwidth measurement tool
Other
6.96k stars 1.28k forks source link

iperf3 UDP send file in reverse mode #594

Open vgramkris opened 7 years ago

vgramkris commented 7 years ago

iperf 3.1.2 CentOS 6.6 x86_64

I am unable to use iperf3 to read/send a test file in reverse mode (from server to client)

Following command works fine where it reads/sends the 2MB dat file successfully from client to server iperf3 -p 25000 -c -u -i 1 -l 1300 -b 20m -t 10 -F 2MB.dat

But, the following command does not initiate a read/send file from server to client. I tried passing the file name in server side, full path in the client side iperf3 command but none of the following works

iperf3 -p 25000 -c -u -i 1 -l 1300 -b 20m -t 10 -F 2MB.dat -R iperf3 -p 25000 -s -i 1

iperf3 -p 25000 -c -u -i 1 -l 1300 -b 20m -t 10 -F /home/test/2MB.dat -R iperf3 -p 25000 -s -i 1

iperf3 -p 25000 -c -u -i 1 -l 1300 -b 20m -t 10 -F /home/test/2MB.dat -R iperf3 -p 25000 -s -i 1 -F 2MB.dat

I expected the above command to read the file from server and send that data to client as the client is running in reverse mode.

bmah888 commented 7 years ago

A number of changes related to --file have taken place on the iperf3 master branch (which will lead up to the iperf 3.2 release). There do seem to be some problems here, as seen on macOS:

Bruce-Mahs-MacBook-Pro:iperf% src/iperf3 -s -F configure
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from ::1, port 54554
warning: Block size 16312 > sending socket buffer size 9216
Increasing socket buffer size to 17336
[  5] local ::1 port 5201 connected to ::1 port 60185
[ ID] Interval           Transfer     Bitrate         Total Datagrams
[  5]   0.00-1.00   sec   143 KBytes  1.17 Mbits/sec  9
[  5]   1.00-2.00   sec   127 KBytes  1.04 Mbits/sec  8
[  5]   2.00-3.00   sec   127 KBytes  1.04 Mbits/sec  8
[  5]   3.00-10.00  sec  9.81 GBytes  12.0 Gbits/sec  645995
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec  9.81 GBytes  8.43 Gbits/sec  0.000 ms  0/646020 (0%)  sender
        Sent 9.81 GByte /  449 KByte (2293445%) of configure
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

Client:

Bruce-Mahs-MacBook-Pro:iperf% src/iperf3 -c localhost --udp -F fubar -R
Connecting to host localhost, port 5201
Reverse mode, remote host localhost is sending
warning: Block size 16312 > sending socket buffer size 9216
Increasing socket buffer size to 17336
[  7] local ::1 port 60185 connected to ::1 port 5201
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  7]   0.00-1.00   sec   143 KBytes  1.17 Mbits/sec  0.008 ms  0/9 (0%)
[  7]   1.00-2.00   sec   127 KBytes  1.05 Mbits/sec  0.010 ms  0/8 (0%)
[  7]   2.00-3.00   sec   127 KBytes  1.04 Mbits/sec  0.009 ms  0/8 (0%)
[  7]   3.00-4.00   sec  81.9 MBytes   687 Mbits/sec  0.015 ms  32948/38213 (86%)
[  7]   4.00-5.00   sec   216 MBytes  1.82 Gbits/sec  0.007 ms  86609/100524 (86%)
[  7]   5.00-6.00   sec   216 MBytes  1.81 Gbits/sec  0.006 ms  87620/101495 (86%)
[  7]   6.00-7.00   sec   215 MBytes  1.80 Gbits/sec  0.036 ms  87571/101389 (86%)
[  7]   7.00-8.00   sec   216 MBytes  1.81 Gbits/sec  0.006 ms  87404/101300 (86%)
[  7]   8.00-9.00   sec   212 MBytes  1.78 Gbits/sec  0.013 ms  87866/101507 (87%)
[  7]   9.00-10.00  sec   215 MBytes  1.81 Gbits/sec  0.005 ms  87703/101551 (86%)
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Jitter    Lost/Total Datagrams
[  7]   0.00-10.00  sec  9.81 GBytes  8.43 Gbits/sec  0.000 ms  0/646020 (0%)  sender
        Sent 1.34 GByte / 1.34 GByte (100%) of fubar
[  7]   0.00-10.00  sec  1.34 GBytes  1.15 Gbits/sec  0.006 ms  557735/646020 (86%)  receiver

iperf Done.

There's something definitely broken here.

Despite this, please note that iperf3 --file is not a file transfer tool, particularly with UDP. Please see the FAQ here: http://software.es.net/iperf/faq.html. (I don't have a link to the specific FAQ entry, but the one I have in mind is the second from the bottom as of this writing).

bmah888 commented 7 years ago

OK. It's not just UDP, in general the combination of --file and --reverse seems to be broken. I'm not sure there's a good use case for this, to be honest.

Basically what's happening is that when the sender of a file runs out of file data, it sets test->done to signal the end of the test. The problem is that this only works on the client side of the test. If the server is the sender, setting test->done just does all sorts of weird things like stopping measurement intervals...also (at least with TCP and no bitrate-limiting) the test speeds up because the sender no longer needs to read data from disk before sending it. At the moment I'm not sure of an easy way for the server to tell the client "hey stop the test".

Right now, this is probably worth a "known issues" statement.

vgramkris commented 7 years ago

Thanks for the clarifications. In certain firewalls they block session initiated from Terminal1 to Terminal2 but they allow if the session is initiated from Terminal2 to Terminal1. In this scenario, I needed to use reverse mode option as I cannot initiate session from the other end (stateful firewalls). Just a use case for reverse + file options.

bmah888 commented 7 years ago

Noted, thanks. I still don't see an easy way to fix this problem, because the ending of the test is controlled by the client, and the client doesn't have a reliable way to know when the server thinks the test is done. This is also related to the other issue you filed recently (#596), where again the server knows when the test is done but it can't easily communicate that to the client.

bmah888 commented 7 years ago

Removing a couple of comments on this issue that appear to be spam...