Sign in to follow this  
NateDog

Please confirm a network noob's understanding of MTU

Recommended Posts

I don't need a deep understanding MTU, but just enough to make some good practical decisions about messages being sent in my MMO. From reading the wikipedia entry (http://en.wikipedia.org/wiki/Maximum_transmission_unit ) it sounds like data travelling over the internet is going to always be in packets of at least 576 bytes. Is this correct? I care about this because I have some game messages that are currently around 150 bytes long. Is the remaining ~400 bytes just wasted space? I've been anal about minimizing all the data I send but if there really is no bandwidth or network performance hit, then there's some additional "nice to have" data that I could potentially add on to these messages.

Share this post


Link to post
Share on other sites
MTU is the *largest* single packet that can be routed through IP.
Any smaller packet will also be routed.
The minimum *MTU* in common use is 576 bytes. That doesn't mean that the minimum *packet* you send will be that big.
A lot of Internet infrastructure (especially DSL links) use ATM, which divides traffic into 48-byte cells. There, everything is quantized to multiples of 48 bytes. A 28 byte UDP header plus a few bytes will still round up to 48, so you'll typically get the first 20 bytes of UDP payload for "free."
If your packet is larger than the MTU, it will likely still make it; it will simply be fragmented on send, and re-assembled on receive. However, there are some cases where such a packet is more likely to be dropped, and there are some badly behaving hardware that refuses to re-assemble fragmented packets.

Share this post


Link to post
Share on other sites
Thanks. And I should have specified this is TCP only for a flash client; no UDP.

So, then you're saying there is going to be a slight network performance gain by staying as small as possible (say 150 bytes vs. 450 bytes) in the message length?

Share this post


Link to post
Share on other sites
Well if nagle is not deactivated and you send the message more frequently than the timelimit your messages are mostlikely batched to one 'big packet' to improve the overhead:data ratio. Btw I guess using TCP implicit using it like a stream.
So do not mind for single packets. This is mostlikely only useful for packet orientated protocols like UDP.

Share this post


Link to post
Share on other sites
for TCP is stream based and not packet based, so it doesn't matter. It's doing the fragmentation and re-assembly, and dealing with MTU, packet loss, ect... internally.

UDP does too, but cannot guarantee a packet larger than a MTU will make it across.

There is no waste sending packet smaller than a MTU, however for efficiency reason, you should send packets as large as possible (while still under MTU size), to avoid packet header overheads.

Share this post


Link to post
Share on other sites
Quote:
there is going to be a slight network performance gain by staying as small as possible (say 150 bytes vs. 450 bytes)


If you turn on TCP_NODELAY, then your latency will be somewhat improved by shorter packets, yes, because transmission time is reduced.
This will be most noticeable on really slow links (low-end DSL, and dial-up).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this