UDP queue size
nick at craig-wood.com
Thu Jun 18 13:29:31 CEST 2009
Martin P. Hellwig <martin.hellwig at dcuktec.org> wrote:
> Scott David Daniels wrote:
> > 找尋自己的一片天 wrote:
> >> I got a problem about UDP.
> >> How do I get the UDP buffer size?
> >> When the server had some delay in handling incoming UDP, it will lost
> >> some package. I wonder it's because the system buffer size, is there any
> >> ways to find the exactly size of the buffer?
> > UDP is defined as "best effort then give up," so _everything_ that
> > handles a UDP packet is allowed to drop it; that means switchers,
> > routers, ..., anything along the path to the target application.
> > So, you cannot expect to do any better than a conservative guess,
> > perhaps augmented by dynamic scaling.
> I would like to add, that you are most likely to lose packages because
> they are to big, I can not remember for sure if UDP had a fixed limit
> above what the MTU does, but you might want to look at that
> direction too.
UDP messages can be up to 64k. However they will be fragmented to the
MTU which is 1500 bytes for most ethernet traffic.
The means that the chance of losing a bigger UDP message is much
higher because you only need to lose one of the fragments to lose the
Most people who use UDP try to keep the total message size below 1500
bytes (1480 data without the header IIRC) for that reason.
wireshark/tcpdump will quickly show you whether you are fragmenting
your UDP messages.
Another thing to bear in mind with UDP is that you can easily exceed
the packets / second that switches / routers can bear if you send lots
of small messages. Switches / routers will start dumping packets if
you do that since. Some switches just crash in my experience too ;-)
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list