Issue
In Niagara G3, how can an ENC be diagnosed as overloaded?
Environment
Niagara G3 ENC-410
Niagara G3 ENC-520
Jace-6
Cause
Programming guidelines needed to prevent overloading the ENC.
Resolution
The CPU usage should be less than 80% on a continuous basis.
The heap.used should be less than 75% of the heap.max value. Java heap is comprised of station objects operating under runtime conditions. Objects are created as needed and destroyed via garbage collection (GC) when no longer needed. Garbage collection is a mechanism provided by the Java Virtual Machine (JVM) to reclaim heap space from objects eligible for collection. An object becomes eligible for garbage collection if its not reachable from any live threads or any static references (e.g. all references are null).
A heap ratio (heap used to heap max) that exceeds 75% causes the JVM to allocate additional time to perform garbage collection and cleanup. This in turn begins to increase CPU usage which slows down overall station processing and performance. Eventually, a station watchdog can occur if the processing becomes too slow rebooting the unit due to a watchdog timeout.
Note: Make sure to execute or manually trigger a garbage collection prior to evaluating the heap.max value. Using Workbench, right-click on the connected station and select Spy from the drop down menu. Select util and gc to execute the garbage collection.
Methods to decrease heap used:
- Removing objects from the station logic that may not be required.
- Reviewing custom objects or programs that may be memory hogs.
- Use of a controller with additional maximum heap. The max heap of a ENC-410 or ENC-520 (non-extended memory 128 MB RAM version) is 48 MB. The extended memory ENC-410 and ENC-520 versions increase the RAM to 256 MB and the maximum heap to 96 MB. The JACE-6E can be purchased with the extended memory option to increase the heap to 96 MB.
- Add another ENC or JACE controller.
Histories can also affect the heap.used value. When the station needs to write a record to a history, it opens the specific history into the running station from the file system if PC based or the ram disk if QNX-based. The open history does contribute to the heap.used of the station. Remove unnecessary or unused histories by disabling the history within the extension, removing the associated history file, and removing the history extension.