gNMI Server Cache Optimization
The gNMI server optimizes cache updates to reduce CPU usage and scale efficiently with higher sensor path counts.
Cache Update Mechanism
When backend modules send data for a sensor-path in JSON format, the gNMI server must update its internal caching database, which stores all sensor-paths in a JSON tree format. Instead of copying and rebuilding the entire cache for each update, the server now directly updates the specific sensor-path using the SetNode()
method from the ytypes
package. This method improves performance by avoiding complete cache tree duplication.
Staggering Sensor-path Processing
To reduce CPU spikes caused by processing multiple sensor-paths back-to-back, the gNMI server introduces a delay between sending each path to the backend. This staggering helps distribute processing load more evenly across the sampling interval.
Wildcard paths: Processing of translated paths will be staggered anywhere between 5 milliseconds and 30 milliseconds, depending on how many paths the wildcard sensor-path translates to. This reduces CPU spikes and prevents back-to-back data processing from these paths.
Key Benefits
|
•
|
Reduces CPU consumption during telemetry streaming. |
|
•
|
Avoids cache duplication and enables faster backend updates. |
|
•
|
Supports large telemetry scale efficiently with smooth operation. |
|
•
|
Prevents gNMI stream disconnections caused by backend overload. |
|
•
|
Dynamically smooths CPU spikes using intelligent delay between sensor-paths. |
|
•
|
Ensures latest data is streamed with minimal processing overhead. |