Hi,
How do I figure out what Mongo was doing the remaining 28.4 seconds?
In mongotop 60 (print an output every 60 seconds), it’s not a straightforward calculation of 60 - 31.6. Rather, it’s the total time spent on that namespace. Depending on how many threads you use, this number can be higher than 60 seconds. For example:
$ mongotop 60
2019-04-01T12:25:08.067+1100 connected to: 127.0.0.1
ns total read write 2019-04-01T12:26:08+11:00
POCDB.POCCOLL 73449ms 31452ms 41996ms
local.oplog.rs 63ms 63ms 0ms
config.system.sessions 10ms 0ms 10ms
admin.system.keys 0ms 0ms 0ms
admin.system.roles 0ms 0ms 0ms
admin.system.version 0ms 0ms 0ms
config.transactions 0ms 0ms 0ms
local.replset.election 0ms 0ms 0ms
local.replset.minvalid 0ms 0ms 0ms
local.replset.oplogTruncateAfterPoint 0ms 0ms 0ms
This example output shows 73.449 seconds spent in the POCDB.POCCOLL namespace using mongotop 60. This is because I used 4 threads to do reads and writes to the POCDB.POCCOLL namespace. In total, all 4 threads are using 73 seconds.
In short, mongotop allows you to determine “hot” collections in your database, where MongoDB spent most of its time processing. This will vary depending on how many threads being used, and is not a linear measurement.
I think ‘mongotop’ only reports processing from primaries, even if secondaries are included in the —host list?
Correct. This is mentioned in the host part of mongotop manual: When specifying the replica set list format, mongotop always connects to the primary..
Best regards,
Kevin