I have observed that the CPU usage of the netopeer2-server process remains consistently around 12.x% on an 8-core CPU system, even when the server is idle with no active NETCONF sessions.
During my investigation, I found the following code in netopeer2:
rc = nc_ps_poll(np2srv.nc_ps, NP2SRV_POLL_IO_TIMEOUT, &ncs);
The default value of NP2SRV_POLL_IO_TIMEOUT is 10 ms. I modified this value to 1000 ms, expecting the function to block longer and thus reduce CPU usage. However, it appears that nc_ps_poll() does not block for the specified timeout, and the CPU usage remains largely unchanged.
This leads me to suspect that the polling mechanism may be waking up earlier than expected, possibly due to internal events, timers, or other file descriptors being monitored.
Could someone please help verify whether this behavior is expected? Additionally, are there any recommended approaches to reduce CPU usage when the server is idle?
Environment:
- netopeer2: [latest devel]
- libnetconf2: [latest devel]
- sysrepo: [latest devel]
- OS: Debian 12 (ARM64, also tried on AMD64)
I have observed that the CPU usage of the
netopeer2-serverprocess remains consistently around 12.x% on an 8-core CPU system, even when the server is idle with no active NETCONF sessions.During my investigation, I found the following code in netopeer2:
The default value of
NP2SRV_POLL_IO_TIMEOUTis 10 ms. I modified this value to 1000 ms, expecting the function to block longer and thus reduce CPU usage. However, it appears thatnc_ps_poll()does not block for the specified timeout, and the CPU usage remains largely unchanged.This leads me to suspect that the polling mechanism may be waking up earlier than expected, possibly due to internal events, timers, or other file descriptors being monitored.
Could someone please help verify whether this behavior is expected? Additionally, are there any recommended approaches to reduce CPU usage when the server is idle?
Environment: