|Subject:||Re: [lwip-users] Why so many pbufs required?|
|Date:||Thu, 13 Aug 2009 04:54:23 -0700|
I'll give you my experience and guesses. Right now I am using 24 buffers of 256 bytes.
Basically you can take 2 approaches to the pool. One is to have a large number of small buffers, and the other is to have a small number of large buffers. The total bytes represented may be the same, but the way lwIP acts may be very different. It's kind of a fine grain vs. coarse grain issue.
It is often found that packets get dropped with a small number of large buffers. If you have memory to burn, then sure use a large number of large buffers. But bare in mind that many packets only contain 60 bytes for ACKs, SYNs, FINs, etc. But if all you have is big buffers, then you get a 1500 byte buffer consumed that's ony 5% utilized, 95% wasted. And something coming in next may have to wait for a buffer or get dropped entirely.
The likely reason you have better results when you add delay in your system, is because buffers have time to get free, so you see less packets dropped. But that indicates you have a buffer problem right there.
Since lwip can chain pbufs together, it's generally better to use a finer grain approach where the buffers are smaller and more of them. It will still handle the larger packets with much the same efficiency, but you won't likely see packets getting dropped.
I've only been working with lwIP for a short time now, and others here have far more experience, but that is my take on things so far.
|[Prev in Thread]||Current Thread||[Next in Thread]|