-
Notifications
You must be signed in to change notification settings - Fork 59
Extending Network Buffers
Increasing size of network buffers is useful if sending uncompressed video or generally receiving or sending higher bit rates.
For streams using bandwidth up to tens or hundreds of Mbps, the information below may be ignored.
You can extend maximal network buffer sizes by doing following steps:
-
add the following text to file
/etc/sysctl.d/60-ultragrid.conf
(create file if not present):# Extended network buffers for UltraGrid net.core.wmem_max=8388608 net.core.rmem_max=72990720 # suitable for uncompressed 8K
-
after the file is edited, run
sudo sysctl -p /etc/sysctl.d/60-ultragrid.conf
to apply the changes -
you can check current values by running
sysctl net.core.wmem_max
(and similarly for rmem_max)
You can also set the values temporarily – instead of steps 1. and 2. just execute:
sudo sysctl -w net.core.wmem_max=8388608
sudo sysctl -w net.core.rmem_max=72990720
A little more theory for interested – there exist also wmem_default and rmem_default keys that set the buffer default sizes if application doesn't set any explicitly. Because UltraGrid does this, these values doesn't need to be set. On the other hand, it would influence other applications not setting theirs buffer values explicitly.
Note: The above values are recommended for 8K uncompressed video. For lower resolution video it can be proportionally lower.
For UltraGrid to run smoothly, you need to extend the network buffers. To do this, open the file /etc/sysctl.conf
with any text editor and the text to it (or modify the current entry, if the values are already present in the file):
# Extended network buffers for UltraGrid
kern.ipc.maxsockbuf=23777280
net.inet.udp.recvspace=21135360 # this may not be necessary
You should also execute following command to apply the setting instantly without reboot and to check if it proceeds flawlessly:
sudo sysctl -w kern.ipc.maxsockbuf=23777280
If macOS is reporting something like:
sysctl: kern.ipc.maxsockbuf=23777280: Result too large
You'd need to execute following command and reboot:
sudo nvram boot-args="ncl=262144" # or 131072 for OS X 10.6 or below
If you are not allowed to execute the above command, it is necessary to boot into the macOS Recovery to extend the mbuf pool size. To do so, please follow About macOS Recovery. In the Recovery mode launch Terminal from the Utilities menu in the menu bar and execute the above command.
You must restart your computer for the changes to take effect:
sudo shutdown -r now
Note: Given network buffer sizes are 4K (~20 MB).
- open configuration dialog of your NIC (Control Panels → Device Manager → Network Adapters → Device)
- select tab Advanced
- from the list, select Performance Options, click Properties button
- set Receive Buffers to 2048 KiB or more if possible (the actual maximum depends on driver and may vary from 2 MiB (integrated NIC) to 32 MiB (10 GE NIC)
If you have any technical or non-technical question or suggestion please feel free to contact us at