[p2p-hackers] Optimal UDP Message size for data streaming...
Daniel Stutzbach
agthorr at cs.uoregon.edu
Sat Feb 25 22:50:56 UTC 2006
On Sat, Feb 25, 2006 at 02:17:42PM -0800, Lemon Obrien wrote:
> I've tried to get TCP-ASYNC Connect to work for a while; i think its
> basicaly a ail marry pass; so i'm going to implement data streaming
> over udp....i jst have one questions...what is a good size to make
> the udp messages (data) when sending over the internet...i know most
> MTUs are about 1500K; is it better to chunk data at say 32 or 64K or
> keep the size smaller. My application works over the internet...not
> a corporate Internet...so bandwidth an all that plays a role.
Keeping the size below the path-MTU is important. If you use larger
datagrams, they'll become fragmented by IP. If any of the fragments
is lost, the whole datagram is lost, meaning you have to retransmit
the whole datagram even though only one fragment was lost (or if you
don't need retransmits, you're losing more data than necessary).
Additionally, since your datagram is now made of several fragments,
there's a greater chance that at least one of them will be lost.
The right solution is to use path-MTU discovery. Initially set your
datagram size to be your local MTU, and set the Don't-Fragment bit in
all your packets. If you get back ICMP Needs Fragmentation messages,
then you gradually lower the datagram size until they fit. You can
also include an extra field in your protocol's initial handshake so
each side learns the other's local MTU (since *typically* the lowest
MTU is at one of the two edges). TCP does all of this for you
behind-the-scenes.
Or you can just set it to something like 1400 and cross your fingers.
1500 is often just a little too high because a significant minority
have extra headers due to PPP, PPPoE, and/or VPNs.
--
Daniel Stutzbach Computer Science Ph.D Student
http://www.barsoom.org/~agthorr University of Oregon
More information about the P2p-hackers
mailing list