Currently, on Linux mongod records the number of CPUs at startup, and uses this information in a couple of contexts:
- FTDC queries the value recorded at startup and reports it at each sample in the "num_cpus" field. This is required for downstream tooling to scale the normalized CPU metrics properly when computing CPU percentage.
- The number recorded at startup is returned by the hostInfo command in the numCores field. This number is used by Ops Manager also for the purpose of scaling the normalized CPU metrics reported on the Ops Manager charts.
The above assumes that the number of CPUs cannot change after mongod startup. However this is not the case, because Linux supports hot-pluggable CPUs and also enabling and disabling CPUs dynamically. If the number of CPUs changes after startup the normalized CPU metrics will be reported incorrectly.
To accommodate this we should dynamically query the number of CPUs so we can report the correct number.
mongod should detect the change in the number of CPUs dynamically and report the number.