If you find the CPU utilization is high when using MongoDB, you can troubleshoot the problem as follows:
Check whether your database operation is too frequent.
Log in to the TencentDB for MongoDB Console and view the QPS on the system monitoring page. If the QPS is high, you may evaluate whether the instance needs to be upgraded. If the QPS is not high, check whether there are any slow queries.
Check whether there are slow logs on mongod.
Log in to the TencentDB for MongoDB Console and view the slow logs of the instance by using "Query statistics".
Pay attention to keywords such as
docsExamined. For more log descriptions, please see Log Messages.
commandindicates an operation recorded in a slow log.
COLLSCANindicates that a full-table scan is performed.
IXSCANindicates that an index scan is performed. For descriptions of other fields, please see Explain Results.
keysExaminedrefers to the number of index entries scanned.
docsExaminedrefers to the number of documents scanned. Larger
docsExaminedvalues indicate that no index is created or the created index is less distinctive. Please check the fields for which an index is created.