Performance Optimization#
For best possible performance, machine vision cameras require suitable accessories and a proper setup of your system.
Find tested accessories for your Allied Vision camera on our website: https://www.alliedvision.com/en/products
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 documentation for your camera, see https://www.alliedvision.com/en/support
Especially for multi-camera applications, you can use the Bandwidth Manager to optimize the performance.
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
Try a larger MaxTransferSize value (see next point)
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
Especially for multi-camera applications, you can use the Bandwidth Manager to optimize the performance.
Linux and ARM#
Additionally to the topics mentioned above, consider the following recommendations.
Real-time thread scheduling policies#
You can enable real-time thread scheduling policies by setting EnableLinuxRealTimeSchedulingPolicies in VmbC.xml to “true”. Additionally, the user must be appropriately configured on the host.
In /etc/security/limits.conf, insert the following lines (replacing username with the user’s username):
username - rtprio 99
username - memlock unlimited
In /etc/pam.d/common-session, insert the following line:
session required pam_limits.so
Then log out and log in. Run, for example, the asynchronous grab example for VmbC and, in another terminal, check that the output of “ps -eLo pid,tid,cls,rtprio,pri,cmd | grep AsynchronousGrab_VmbC” looks something like:
12867 13079 FF 70 110 ./AsynchronousGrab_VmbC
If the configuration failed, the output looks something like:
19029 19250 TS - 19 ./AsynchronousGrab_VmbC
and the logs will contain a warning that includes the text “normal scheduling will be attempted”.
Additional settings#
If the real-time scheduling does not work, try the following:
In /etc/security/limits.conf, insert
username soft rtprio 50
username hard rtprio 99
username soft nice -10
username hard nice -20
username soft memlock 512000
username hard memlock unlimited
Make all the same insertions in /etc/security/limits.d/90-realtime.conf (if present) as were inserted in /etc/security/limits.conf above.
For non-Debian/Ubuntu systems, insert “session required pam_limits.so” also in /etc/pam.d/system-auth and /etc/pam.d/password-auth, as was inserted in /etc/pam.d/common-session above.
For non-interactive use, insert “session required pam_limits.so” also in /etc/pam.d/common-session-noninteractive, as was inserted in /etc/pam.d/common-session above.
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.
Increasing MaxTransferSize:
If frames are incomplete, you can try to increase the MaxTransferSize in the VimbaUSBTL.xml file to 1,048,576 or higher.
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://www.alliedvision.com/assets/documents/products/software/embedded/Optimizing-Performance-Jetson_appnote.pdf