The tcp_sendspace tunable

The tcp_sendspace tunable specifies how much data the sending application can buffer in the kernel before the application is blocked on a send call.

The TCP-socket send buffer is used to buffer the application data in the kernel using mbufs/clusters before it is sent to the receiver by the TCP protocol. The default size of the send buffer is specified by the tcp_sendspace tunable value or the program can use the setsockopt() subroutine to override it.

You should set the tcp_sendspace tunable value at least as large as the tcp_recvspace value, and for higher speed adapters, the tcp_sendspace value should be at least twice the size of the tcp_recvspace value.

If an application specifies O_NDELAY or O_NONBLOCK on the socket, which leads to nonblocking I/O, then if the send buffer fills up, the application will return with an EWOULDBLOCK/EAGAIN error rather than being put to sleep. Applications must be coded to handle this error (suggested solution is to sleep for a short while and try to send again).