System Settings
For best possible performance, machine vision cameras require suitable accessories and a proper setup of your system.
Find tested accessories for you Allied Vision camera on our website: https://www.alliedvision.com/en/products/accessories/
All operating systems
GigE cameras
Use Category 6 or higher rated Ethernet cables
Use only one camera per Ethernet port
Optimize the NIC settings:
Disable all unused NIC services and protocols (for example, activate only filter drivers for IPv4 and GigE on Windows)
Enable Auto Negotiation (not Fixed Link Speed)
Windows only: Use the Filter Driver provided with Vimba X
Windows: Enable Jumbo Frames on your NIC
Detailed information is availabe in the User Guide for your camera, chapters Configuring the host computer and Performance and troubleshooting, availabe at: https://www.alliedvision.com/en/support/technical-documentation/
USB cameras
For best possible bandwidth with multiple cameras, don’t use a hub
Note that some 4-port PCIe cards have limitations, they use shared resources
Use USB host adapter cards and USB PCIe host controllers with a high performance, see https://www.alliedvision.com/en/products/accessories
For detailed information, see the User Guide for your camera, chapter Performance and troubleshooting and the Application Note Considerations for Setting Up USB Vision Systems
Linux and ARM
Additionally to the topics mentioned above, consider the following recommendations.
USB cameras
Increasing the USBFS buffer size:
By default, the USBFS buffer size may be 16 MB. This value is too low for image sizes > 2 MB or high frame rates. Check the USBFS buffer size:
cat /sys/module/usbcore/parameters/usbfs_memory_mb
Increase the USBFS buffer size until the next reboot (here: example value 1000):
sudo sh -c 'echo 1000 > /sys/module/usbcore/parameters/usbfs_memory_mb'
Increase the USBFS buffer size permanently
To increase the buffer size permanently, add the kernel parameter usbcore.usbfs_memory_mb=1000 the bootloader configuration. If and how this is possible depends on the bootloader on your system.
Note
Before changing the bootloader configuration, create a backup of your system.
A faulty bootloader may cause that your system doesn’t start up. A fix might require an external boot media or reinstallation of the system. Note that changing the bootloader configuration is at your own risk.
Syslinux: Edit /boot/extlinux/extlinux.conf, add usbcore.usbfs_memory_mb=1000 to the APPEND line, and reboot the system.
If you have installed GRUB 2:
Open /etc/default/grub. Replace: GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” (or other contents within the quotation marks depending on your system) with: GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash usbcore.usbfs_memory_mb=1000”
Update grub: sudo update-grub and reboot the system.
Other bootloaders: To configure additional kernel parameters of other bootloaders, please see the manual of your bootloader.
GigE cameras
Setting the MTU of the internal host adapter: Set the MTU of the internal host adapter, assuming the camera is connected to Ethernet port eth0:
sudo ip link set eth0 down
sudo ip link set eth0 mtu 9000
sudo ip link set eth0 up
Additionally, set the feature GVSPBurstSize to 32 or higher for usage with 5GigE cameras.
Increasing the OS receive buffer size:
If your use case requires high bandwidth, we recommend increasing the OS receive buffer size (these settings affect all types of connections on the system):
sudo sysctl -w net.core.rmem_max=33554432
sudo sysctl -w net.core.wmem_max=33554432
sudo sysctl -w net.core.rmem_default=33554432
sudo sysctl -w net.core.wmem_default=33554432
Optimizing your SOM
To optimize your NVIDIA Jetson SOM, read: https://cdn.alliedvision.com/fileadmin/content/documents/products/software/software/embedded/Optimizing-Performance-Jetson_appnote.pdf
macOS
Additionally to the topics mentioned above, consider the following recommendations.
USB cameras
For best performance on MacMini, use the USB ports. They have a higher performance than the Thunderbolt ports combined with a USB adapter.
GigE cameras
MTU size and Speed
Check and set the MTU size and Speed:
Open System Settings
Go to Network
Select the relevant interface and select Details.
Set MTU size to Jumbo Frames and set the highest possible speed for your interface.
Increase the GigE receive buffer size
Display the current settings:
# Display current settings
# Current UDP receive buffer size
sysctl -n net.inet.udp.recvspace
# Default: 131.072
# Current TCP receive buffer size
sysctl -n net.inet.tcp.recvspace
# Default: 131.072
# Current TCP send buffer size
sysctl -n net.inet.tcp.sendspace
# Default: 131.072
# The buffer sizes are limited by the maxsockbuf value
sysctl -a | egrep nmbcl\|maxsockb
# Default:
# maxsockbuf=8.388.608
# nmbclusters=262.144
# recvspace + sendspace < maxsockbuf
# maxsockbuf = (nmbclusters*2048)/16
Note that after rebooting with a new nmbclusters /ncl value, the maxsockbufs value is not necessarily adjusted to its maximum automatically. You can adjust the value via sysctl -w as described below.
Prepare increasing the receive buffer size (requires disabling System Integrity Protection):
Warning
Disabling SIP (System Integrity Protection) fully or partly is done at your own risk. Without SIP, your computer is vulnerable to malicious code. Disabling System Integrity Protection might lead to unknown system behavior.
While turning on your Mac, press and hold the power button until the boot menu appears.
Select Utilities and launch the Terminal.
To disable System Integrity Protection at your own risk, run:
csrutil disable
Reboot your Mac as usual.
Open a Terminal window and run the commands:
sudo nvram boot-args="ncl=524288" sudo shutdown -r now`
After the reboot is complete, the next steps are different for non-persistent and persistent changes.
Non-persistent changes:
Open a Terminal window and run the commands:
sudo sysctl -w kern.ipc.maxsockbuf=67108864
sudo sysctl -w net.inet.udp.recvspace=33554432
Persistent changes:
Open a Terminal window and run the command:
sudo nano /Library/LaunchDaemons/AlliedVision.sysctl.plist
Paste the following lines into the editor and save the file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>sysctl</string> <key>ProgramArguments</key> <array> <string>/usr/sbin/sysctl</string> <string>-w</string> <string>kern.ipc.maxsockbuf=67108864</string> <string>net.inet.udp.recvspace=33554432</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
Because changes to the boot arguments were made, SIP (System Integrity Protection) cannot fully be enabled again, because this would remove the boot-arg and therefore also reset the depending receive buffer size to its default value.
Leave SIP disabled: If you do nothing, SIP is disabled.
Partly enable SIP:
While turning on your Mac, press and hold the power button until the boot menu appears.
Select Utilities and launch the Terminal. Run:
csrutil enable --without nvram
Restart your Mac.
Restore default values:
Temporarily disable System Integrity Protection (see above).
Open a terminal window and run the commands:
sudo nvram boot-args="" sudo shutdown -r now
Enable System Integrity Protection again (see above).