How to increase socket buffer sizes on QNX

If you follow the recommendations on the Improve RTI Connext DDS Network Performance on Linux Systems KB article, you’ll see that the rmem/wmem_default settings need to be increased. These 2 settings have no limit.

On QNX, however, you’ll see that those 2 values have a limit: 233016 bytes. This limit is given by the sbmax value:

# sysctl -a | grep kern.sbmax
kern.sbmax = 262144

If you try to increase the values over 233016, sysctl may not behave correctly. If on Connext you try to set a bigger send_socket_buffer_size (5000000) and you set verbosity to LOCAL, you’ll see this message:

NDDS_Transport_UDPv4_SocketFactory_setSendBufferSize:The specified send_socket_buffer_size,
5000000, was not set. The actual send socket buffer size is 9216

In order to increase the sbmax value (for instance, to ~6 MB), you have to run the following:

# sysctl -w kern.sbmax=6000000
After this, you can increase the send and receive socket buffer sizes:
# sysctl -w net.inet.udp.sendspace="5000000"
net.inet.udp.sendspace: 9216 -> 5000000
# sysctl -w net.inet.udp.recvspace="5000000"
net.inet.udp.recvspace: 41600 -> 5000000

If you run an application with verbosity LOCAL and setting those new buffers, the warning message will disappear.