MongoDB CPU cores check¶
Description¶
This advisor warns if the number of CPU cores does not meet the minimum requirements according to best practices.
To avoid performance issues, see the following documentation to determine the number of CPU cores required for your environment:
- MongoDB 4.0 Production notes
- MongoDB 4.2 Production notes
- MongoDB 4.4 Production notes
- MongoDB 5.0 Production notes
- MongoDB 6.0 Production notes
Rule¶
db.adminCommand({'getDiagnosticData':1}).data.systemMetrics.cpu.num_cpus
data = docs[0]["data"]
print(repr(data))
systemMetrics = data.get("systemMetrics", {})
print(repr(systemMetrics))
cpu = systemMetrics.get("cpu", {})
numcpu = int(cpu.get("num_cpus", fail))
Resolution¶
Increase the number of CPU cores so that it does not impact the performance.
Need more support from Percona?¶
Percona experts bring years of experience in tackling tough database performance issues and design challenges.