reactive-firewall / multicast

This repo is basically a wrapper for sending and receiving UDP multicast messages via python. Y.M.M.V. This library is not intended to fully implement the complexities of multicast traffic, rather to allow a user friendly API for python components to send and receive across a multicast transmission. The obvious advantage of this wrapper over unicast solutions is the ability to have multiple nodes communicate concurrently without individual connections for each node pair.
Other
2 stars 0 forks source link

I have a question about the buffer size 1316 used by multicast #57

Closed reactive-firewall closed 1 week ago

reactive-firewall commented 1 week ago

Describe the question why is the chunk size 1316 in the code here:

https://github.com/reactive-firewall/multicast/blob/37437e22325fbca99653518b708fe800342c9dc2/multicast/recv.py#L311

Expected answer form This is a common value from video streaming traffic and should work well on most networks ... etc.

Related Documentation (optional) ???

Additional context why not a number like 9000 (jumbo frames)

reactive-firewall commented 1 week ago

Answer: The value of 1316 is arbitrary but based on the following heuristic:

Start with

How we got to this:

Theory

1500 is a common max size for underlying IP packets in general, because of the prevalence of Ethernet, who's frames are that size, but some space MUST be used for the header: ( 8 bytes for UDP + 20 bytes for IP ) = 28 bytes = 224 bits for headers This leaves us with a max closer to 1276 bits which just seemed odd and minimal when compared to an IPv6 smallest MTU of 1280 ... so the same equation 8 UDP + max 40 ipv6-header is even smaller: 🤓 looking to ipv6 with a 40 byte header we get 1500-48 ( 384 ) = 1116 bytes

(btw TCP headers can be as much as 20-60 bytes but then we would use 956 bytes chunks instead for similar logic worsening the issue)

Search the world wide web

🙉 Turns out this issue is not unique to this UDP multicast library project, and is debated without standardization much beyond the theory...

Conclusion

🤷🏻 So in the end it was just made up and is tested in CI.