Don't lower SNDBUF/RCVBUF
Development toolkit for Web Services and XML data bindings for C & C++
Brought to you by:
engelen
In the function tcp_connect
, SOAP issues setsockopt(sk, SOL_SOCKET, SO_RCVBUF, &len, sizeof(len))
, with len
defaulting to SOAP_BUFLEN
(which happens to be 65536 here). This is less than what the operating system sets as default for the socket, which can mean a performance degradation. Please do not lower socket buffer size(s), only raise them.
Same applies to SNDBUF.
Thanks for the feedback.
Your recommendation is under the (mostly false) assumption that larger buffers are always better. The optimal buffer size is determined by throughput and latency. If the latency is low or if throughput is low, a small buffer is just fine. We found that 64K gives a decent performance in most cases, with larger buffers (256K) only giving a marginally better performance or no improvement in common client/server deployments.
You can increase SOAP_BUFLEN (with -DSOAP_BUFLEN=xxx) and recompile all sources!) to optimize performance and increase the default TCP buffer size. See our FAQ on performance optimizations.
Last edit: Robert van Engelen 2016-04-09
The
SO_SNDBUF
size is not 8K unless you changeSOAP_BUFLEN
to 8K. TheSO_SNDBUF
size is not affected byWITH_LEAN
(WITH_LEAN
does not set these socket options).The default is 64K, which is a general recommendation by e.g. gridFTP and other higher performance TCP-based xfer tools, with upward of 64K giving only marginal improvements in typical cases. I had found somewhere that the max is 64K on Mac OS X (perhaps this has changed). But on most systems 256K or larger is ignored.
I will add a
soap.sndbuf
andsoap.rcvbuf
size to the upcoming 2.8.31 release to let users configure theSO_SNDBUF
andSO_RCVBUF
socket options, which will still be set to 64K as the default. Users can changesoap.sndbuf
andsoap.rcvbuf
(after the context init). Setting these to zero will omit thesetsockopt
calls forSO_SNFBUF
and/orSO_RCVBUF
altogether. Setting to zero is useful for Linux to enable "send buffer autotuning".