• CUWB v5.0
APD002 - Linux UDP Buffers

Introduction

The default UDP buffer sizes in Linux are woefully small for any services that make heavy use of UDP. The default RX buffer limit is set to 208kB. CUWBNets running with a reasonable quantity of nodes (say 30 or more) or that are running at high position rates (say 100Hz or greater) may experience loss of data due to these default limits. The data loss can be hard to notice, but usually has the affect of more jitter in the position computed for devices or anchors dropping out in the CUWB Viewer.

When installing the latest versions of CUWB Manager Package (3.0 and greater) the user is prompted with a chance to set the default UDP buffers to a more reasonable figure (100MB). If you choose not to increase the buffers during installation, you can always reconsider this decision by running sudo dpkg-reconfigure cuwb-network. Changing the UDP buffer limit can significant impact on system performance. We recommend setting this regardless of the size or speed of your setup.

Docker

If you are running in a docker container, you will find that docker does not allow you to set this setting, because it inherits the values from the host system.

Linux

If the host system is linux, then the following will help you setup the host appropriately.

To make the change on a running system, run the following command:

sudo sysctl -w net.core.rmem_max=104857600

Then restart the CUWB Network. This change will go away upon system reboot.

To make the changes permanent, edit the file /etc/sysctl.conf. Add the following line to the bottom:

net.core.rmem_max=104857600

This change will only take place upon reboot.

In order to increase the UDP buffers in Linux there are several system parameters that need to be updated. To update these parameters temporarily you can run the following commands from a command prompt in Linux:

Increasing Receive Buffers

sudo sysctl -w net.core.rmem_default=33445532
sudo sysctl -w net.core.rmem_max=104857600
sudo sysctl -w net.ipv4.udp_mem='33445532 33445532 33445532'
sudo sysctl -w net.ipv4.udp_rmem_min=33445532

Increasing Transmit Buffers

sudo sysctl -w net.core.wmem_default=33445532
sudo sysctl -w net.core.wmem_max=104857600
sudo sysctl -w net.ipv4.udp_mem='33445532 33445532 33445532'
sudo sysctl -w net.ipv4.udp_wmem_min=33445532

These setting change the minimum buffer sizes to 32MB with a maximum of 100MB. You can adjust the numbers to something that you feel is more appropriate to your system. By default the buffer sizes in Linux are set to 208kB which does not provide a lot of head room for the processor before the buffers fill up.

After making these changes, you will need to restart all applications that use the UDP buffers in order for them to re-connect to their respective sockets with the new buffer sizes. If you make the changes using the above method the setting will be lost when the system is rebooted.

In order to make the change more permanent, edit the ‘/etc/sysctl.conf’ file. The file is only editable by root so you will need to edit the file with root privileges and add the following lines to the end of the file:

net.core.rmem_default = 33445532
net.core.rmem_max = 104857600
net.core.wmem_default = 33445532
net.core.wmem_max = 104857600
net.ipv4.udp_mem = 33445532 33445532 33445532
net.ipv4.udp_rmem_min = 33445532
net.ipv4.udp_wmem_min = 33445532

After adding the lines, run the following command on the server to cause the new values to be stored. You should see a print out of the values that were updated.

sudo sysctl -p

To verify that the settings worked, run the following (note you can do this before the edits to see what the current values of the buffers are)

sudo sysctl -a | grep mem

Again, you will need to stop and restart any applications you have running that use the UDP buffers in order for them to connect with the new values. You may also choose to simply reboot the system after making the appropriate changes to the sysctl.conf file.

Revision

Version Date Change Description
5.0.0 2025-09-15 Initial Preliminary Release