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 (not needed for GigExpress):

  • 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:

  1. 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”

  2. 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

GigExpress#

GigExpress is Allied Vision’s high-performance optimization technology for Linux x86_64 systems. It is designed to minimize CPU overhead when streaming from GigE Vision cameras.

Compatibility and prerequisites:

  • To use GigExpress, you need a specific Allied Vision Network Interface Card (NIC) available at https://www.alliedvision.com/en/products/accessories/interface-cards. These cards come with preconfigured settings such as Jumbo Frames, so that you don’t have to configure these cards yourself.

  • GigExpress is currently only supported for users with sudo rights.

  • Install Vimba X including VimbaGigETL (see information above)

  • GigE camera with 1G, 5G, or 25G interface.

Note that changing GigExpress settings requires knowledge of Linux networking and eBPF concepts.

If you have questions about GigExpress or need assistance, please contact our Technical Support team.

Preparation:

  • Connect the cameras and NICs you want to use with GigExpress. Identify the NIC interface names, e.g., with ip -o link show | awk -F': ' '{print $2} and copy the interface names you want to use with GigExpress.

  • List cameras with Vimba X Viewer or ListCameras_VmbC.exe in [Vimba X install directory]/bin and copy the DEV IDs of all cameras you want to use with GigExpress.

Enabling and setting up GigExpress

  • Go to [Vimba X install directory]/cti and open VimbaGigETL.xml.

  • Please refer to the comments in the XML file.

  • Replace “your_interface_name” with the interface name on your host you want to use for GigExpress. If several interfaces are used, copy the <Interface> section and insert the corresponding names.

  • Use the optional lines only if needed to tweak the performance.

Tip

Copy all files you changed and save them outside the Vimba X install directory to reuse them after installing a newer version.

Optimizing your SOM#

To optimize your NVIDIA Jetson SOM, read: https://www.alliedvision.com/assets/documents/products/software/embedded/Optimizing-Performance-Jetson_appnote.pdf