I had someone question me as to why the router appears to be misreporting its CPU utilization… So as I haven’t written anything around this topic, I figured I would make a note for any future engineers struggling to understand what is going on in their routers.
From a very simplistic view, routers perform two functions in CPU. They forward packets and the perform management/control plane functions.
When you type ‘show process cpu’ at the CLI, the 5 sec Utilization statistic prints two percentages, for example:
router> show process cpu
CPU utilization for five seconds: 94%/91%; one minute: 97%; five minutes: 97%
PID Runtime(ms) Invoked uSecs 5Sec 1Min 5Min TTY Process
1 12 176 68 0.00% 0.00% 0.00% 0 Chunk Manager
2 40976 1563329 26 0.07% 0.13% 0.13% 0 Load Meter
4 0 1 0 0.00% 0.00% 0.00% 0 EDDRI_MAIN
5 0 1 0 0.00% 0.00% 0.00% 0 RO Notify Timers
... removed for brevity ...
You will most likely notice when perusing the percentages for each process below, they don’t add up any of the utilization statistics as depicted in the first line of output with the running five second, one minute, and five minute averages.
This is because the first line, is a combination of CPU consumed by the forwarding of packets and CPU consumed by all processes running in the management/control plane of the router.
If you look closely, there are two percentages stated for the 5 second average. The first one depicts an actual total of all CPU consumption in the past 5 seconds, while the second percentage notes the percentage of time the CPU has spent forwarding packets.
It is also relevant to note that the percentage of time utilized for forwarding packets is not a linear scale, and that more than half of the forwarding capacity of the box is handled in the last 5% (as in from 95-100%) of the CPU, when the router is configured with CEF.
So what this means is that only 3% of the CPU is being consumed by management or control plan processes and the other 91% of the CPU being consumed is due to the router simply spending a large amount of the time in the portion of the polling loop forwarding packets from one interface to another. Maybe some day, I’ll blog about the difference in how a router utilizes the CPU vs a standard operating system. Feel free to research on your own until then.. the short is a router uses a polling loop instead of interrupts to process packets.
In the instance noted above, when we looked at interface utilization, it was due to a backup running which was having to be intervlan switched at the router. Looks like we should have installed a distribution switch at this location.