Subject: Re: udp receive buffer overflow with many small packets
To: Stuart Brooks <stuartb@cat.co.za>
From: Jonathan Stone <jonathan@dsg.stanford.edu>
List: tech-net
Date: 04/25/2005 10:43:53
In message <08b301c54963$b3ff2540$5e22a8c0@STU95>"Stuart Brooks" writes
>This worked, doubling the size of the receive buffer doubled the number
>of message which could be queued. Looking at the numbers, the default
>receive buffer of around 42kB is roughly 162 messages*256B.
>
>What had me confused initially was that the FIONREAD ioctl was saying
>that the receive buffer had 16kB of data when it started throwing away
>packets. Of course, this is 16kB of *user data* (because of small
>packets) but the rest of the space is being used behind the scenes
>(because of 256B mbufs?).
Yes. I'm sure I have said this before in this thread, but with packets
that small, you *will* run into the limit on allocated buffer space
(mbufs) before you run into the limit on bytes.
Your effective limit on small packets will be something 0.3 (maybe
0.25) times the apparent byte limit: not only do you incur one mbuf
for the data, you may well incur another for the addresses.
(Some protocols do; i haven't actually UTLSed to check UDP).
I have never gotten the kernel to honour socket-buffer sizes above
199608. So, if you need more than about 48k of actual small-packet
data, you'll probably have to build a custom kernel.
(Numbers above are to BOTE accuracy only.)
>Thanks for all of the help,
> Stuart