CPU usage is an important metric of system performance, and certain factors can have a big impact on scan engine performance, without much application logic. Table 1 below details a simple PID loop run on a legacy CompactRIO 9012 Controller. As the number of channels used increases, the CPU usage increases. This effect is compounded as the controller's Scan Rate is increased. At 1000Hz, the CompactRIO 9012 was not able to read/write to more than 16 AI/AO pairs without reaching maximum CPU usage.
Note: More modern CompactRIO Controllers will not have this problem - these benchmarks are provided to show the effect that increasing channel counts and sample rates have on CPU usage.
|Number of Channels (AI/AO pair)||100 Hz||500 Hz||1000 Hz|
Table 1. CPU usage for Scan Mode PID application at various scan rates
Another key factor affecting CPU usage is network publishing of data. I/O variables support network publishing for remote data access and monitoring, but using this network publishing can have significant CPU overhead, based on the publishing period selected. Figure 6 compares the system CPU usage for various network publishing rates.
Figure 6. Network publishing overhead for analog I/O variables at various publishing rates
The test setup used for the network publishing benchmarks included continuously changing analog input data from NI 9205 modules. The test used NI Distributed System Manager probes to monitor the input data on all the I/O modules and to record the total CPU usage for each scenario. The results reflect the total CPU usage with the I/O scan running at the default period of 10 ms and network publishing either disabled for all I/O variables or enabled at various network publishing rates.
Network publishing overhead is typically negligible if no remote client is connected to the target or if the I/O data is not changing quickly. But as figure 6 shows, the CPU usage can become significant when monitoring a large number of continuously changing analog I/O channels. Network publishing is enabled by default for I/O variables. However, you can disable network publishing for the individual I/O variables using the Shared Variable Properties dialog box. You also can disable network publishing for multiple I/O variables at once using the Multiple Variable Editor. The “Publishing Disabled” series in figure 6 represents the baseline CPU usage of the system with only the I/O scan running and network publishing disabled for all I/O variables.
To optimize your system’s CPU usage, you can either slow down the network publishing rate by adjusting the Network Publishing Period on the Scan Engine page of the RT Target Properties dialog box, disabling network publishing for I/O variables that you are not monitoring remotely, or making sure you don’t have a remote client connected to any I/O module unless it is using the I/O data for remote access or monitoring.