On Sat, 2007-01-27 at 18:33 -0800, David Barrett wrote:
> So I’m having a discussion with a friend, and we’re debating what
> seems like an obvious point:
>  
> Is it actually any cheaper to send a 0-byte UDP packet than to send
> one that is sized at the MTU?
> 
> I’d *hope* that it’s cheaper, but I don’t honestly know if this is the
> case.

It actually depends on just how far the packet is going and over what
sorts of physical links.

If your transmission is bandwidth constrained (which is the assumed case
for long-haul) then a 0 byte UDP packet is a lot cheaper.

If your transmission is latency constrained, then it matters very little
how big the packet is.  If two relatively quiet workstations (i.e. they
aren't currently engaged in a large file transfer or other high-traffic
activity) are communicating on a LAN, especially a gigabit LAN, then
your transmission is constrained by latency, mostly of the OS and
internal hardware busses.  So in this situation, packet size matters
almost not at all.

Additionally the physical medium matters some.  Various physical layers
will have various padding requirements.  It's very hard to tell for
long-haul networks exactly which physical layers are operative.  But for
LANs its almost certainly Ethernet.  I don't know what Ethernet's
minimum frame size is, and I think that faster versions of Ethernet may
have larger minimum frame sizes.  But this means that in the case where
you know the only physical layer being traversed is Ethernet, there is
no sense in sending a packet that is less than the minimum frame size.

In _all_ of these cases, if you have 1300 bytes of data to send, it is
much better to use a 1300 byte UDP datagram instead of many smaller
datagrams.

> In other words, to what degree should a UDP protocol attempt to shave
> off that extra few bytes per packet?

I would say that in most cases for a protocol that is expected to
operate over a long-haul network, it's important to shave bytes out of
your UDP frames, if you can.  Perhaps someday we will have so much
cross-country bandwidth that it cannot ever be at more than about 10%
capacity, but I really doubt it.  This means that you should design for
a bandwidth constrained environment for a globally distributed system
instead of a latency constrained one.

Have fun (if at all possible),
-- 
The best we can hope for concerning the people at large is that they
be properly armed.  -- Alexander Hamilton
-- Eric Hopper ([EMAIL PROTECTED]  http://www.omnifarious.org/~hopper) --

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
p2p-hackers mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/p2p-hackers

Reply via email to