scionproto / scion

SCION Internet Architecture
https://www.scion-architecture.net/
Apache License 2.0
369 stars 156 forks source link

snet: investigate overhead of port checks during Listen #4550

Open matzf opened 2 weeks ago

matzf commented 2 weeks ago

Follow up on #4344.

snet.Listen/Dial/OpenRaw open ephemeral ports in a the range of the router-dispatched ports. For this, it attempts to open a UDP socket for each port in the range, iterating from end to the start of the range. As the order is the same for every application, the ports toward the end of the range will frequently already be in use. Investigate how significant the overhead of this port checking is. If necessary, find alternatives; one alternative could be to randomize the order of checking. This would reduce the number of expected checks necessary as long as the number of simultaneously open ports is well below the size of the range.