Thursday, 3 August 2023

MongoDB Profiler

Profiler collects fine grained data about MongoDB write operations, cursors, database commands on a running mongod instance.

You can enable profiling on a per-database or per-instance basis.
The profiler is off by default.

Profiler writes all the data it collects to the system.profile collection, which is a capped collection.

*.Profiling Levels
0 – the profiler is off, does not collect any data
1 – collects profiling data for slow operations only. By default slow operations are those slower than 100 milliseconds.
2 – collects profiling data for all database operations.

Enable Profiling :  db.setProfilingLevel(1, { slowms: 20 })

Disable Profiling :  db.setProfilingLevel(0)

Get Profiling Info: db.getProfilingStatus()

All details regarding performance issues related written in mongod.log file by default located in /var/log/messages/mongd/mongd.og

 

For more detail about profiling : ClickHere

No comments: