inet buffer size for TCP

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

inet buffer size for TCP

Frank Muller
Hi all

The inet () documentation states :

{buffer, Size}

    The size of the user-level buffer used by the driver. Not to be confused with options sndbuf and recbuf, which correspond to the Kernel socket buffers. For TCP it is recommended to have val(buffer) >= val(recbuf) to avoid performance issues because of unnecessary copying. For UDP [...]


Question: which is best here:

val(buffer) = val(recbuf)

val(buffer) = val(recbuf) + (1/4 *val(recbuf))

val(buffer) = val(recbuf) + (2/4 *val(recbuf))

val(buffer) = val(recbuf) + (3/4 *val(recbuf))

val(buffer) = 2 * val(recbuf)

Is there any optimal value?

/Frank



Reply | Threaded
Open this post in threaded view
|

Re: inet buffer size for TCP

Lukas Larsson-8


On Thu, Dec 12, 2019 at 7:43 PM Frank Muller <[hidden email]> wrote:
Hi all

The inet () documentation states :

{buffer, Size}

    The size of the user-level buffer used by the driver. Not to be confused with options sndbuf and recbuf, which correspond to the Kernel socket buffers. For TCP it is recommended to have val(buffer) >= val(recbuf) to avoid performance issues because of unnecessary copying. For UDP [...]


Question: which is best here:

val(buffer) = val(recbuf)

val(buffer) = val(recbuf) + (1/4 *val(recbuf))

val(buffer) = val(recbuf) + (2/4 *val(recbuf))

val(buffer) = val(recbuf) + (3/4 *val(recbuf))

val(buffer) = 2 * val(recbuf)

Is there any optimal value?

Not a general optimal value. It will depend on what data you are sending and which packet mode you are using. If not using any packet mode (aka raw), then I would say that "val(buffer) = val(recbuf)" should be the best option.
 

/Frank



Reply | Threaded
Open this post in threaded view
|

Re: inet buffer size for TCP

Frank Muller
Ok, thanks.

/Frank



On Thu, Dec 12, 2019 at 7:43 PM Frank Muller <[hidden email]> wrote:
Hi all

The inet () documentation states :

{buffer, Size}

    The size of the user-level buffer used by the driver. Not to be confused with options sndbuf and recbuf, which correspond to the Kernel socket buffers. For TCP it is recommended to have val(buffer) >= val(recbuf) to avoid performance issues because of unnecessary copying. For UDP [...]


Question: which is best here:

val(buffer) = val(recbuf)

val(buffer) = val(recbuf) + (1/4 *val(recbuf))

val(buffer) = val(recbuf) + (2/4 *val(recbuf))

val(buffer) = val(recbuf) + (3/4 *val(recbuf))

val(buffer) = 2 * val(recbuf)

Is there any optimal value?

Not a general optimal value. It will depend on what data you are sending and which packet mode you are using. If not using any packet mode (aka raw), then I would say that "val(buffer) = val(recbuf)" should be the best option.
 

/Frank