USNavalResearchLaboratory / mgen

Multi-Generator (MGEN) traffic generation tool
https://www.nrl.navy.mil/itd/ncs/products/mgen
Other
83 stars 25 forks source link

Delay between SEND and SHUTDOWN events for TCP flows #20

Closed ojroques closed 4 years ago

ojroques commented 4 years ago

Hello,

I'm using MGEN to measure flow completion time of TCP flows of various flow sizes in a congested network. I've noticed that for any flow size, the delay between a SEND event and SHUTDOWN will always be greater or around 1s. Even if flow size is really small (< 1MTU for instance).

Client-side:

olivier@oroques-dev:~$ mgen event "ON 1 TCP DST localhost/5000 PERIODIC [1 1000] COUNT 1,OFF" txlog 2> /dev/null
14:45:22.556771 START Mgen Version 5.1.1
14:45:22.557019 ON flow>1 srcPort>34853 dst>127.0.0.1/5000
14:45:22.557066 CONNECT flow>1 srcPort>34853 dst>127.0.0.1/5000
14:45:22.557090 SEND proto>TCP flow>1 seq>0 srcPort>34853 dst>127.0.0.1/5000 size>1000
14:45:23.557127 SHUTDOWN flow>1 srcPort>34853 dst>127.0.0.1/5000  # ~1s later, even though data has been received long before that
14:45:23.557280 OFF flow>1 srcPort>34853 dst>127.0.0.1/5000
14:45:23.557338 STOP

Server-side:

olivier@oroques-dev:~$ mgen event "LISTEN TCP 5000" 2> /dev/null
14:45:20.579566 START Mgen Version 5.1.1
14:45:20.579641 LISTEN proto>TCP port>5000
14:45:22.557066 ACCEPT src>127.0.0.1/34853 dstPort>5000
14:45:22.557144 RECV proto>TCP flow>1 seq>0 src>127.0.0.1/34853 dst>127.0.0.1/5000 sent>14:45:22.557090 size>1000 gps>INVALID,999.000000,999.000000,4294966297
14:45:23.557247 OFF src>127.0.0.1/34853 dstPort>5000

Where does that delay come from? Is there a way to disable it so that we can have a reliable FCT for small flows ? Thanks.

ojroques commented 4 years ago

I've looked into the code and it is due to the rate parameter that is non-negative. Therefore this condition is always true and we never reaches the line that would stop the flow.

Setting the rate parameter to -1.0 solves the problem. I did not find that option in the documentation though, it would be useful to add it.

ljt-git commented 3 years ago

Setting the rate parameter to -1.0 does not log a shutdown event for the flow.