Mongodb – “[ftdc] serverStatus was very slow” – MongoDB 4.0.4

mongodbmongodb-4.0

I'm seeing very frequent messages like this in mongod.log and doesn't give an exact reason for the server status was very slow.
looks like ftdc logs more information but interpreting ftdc log is very tedious method and is not human readable format.

Due to this issue mongo daemon stops working abruptly and becomes stale which results in replication issues and loosing quorum and hence DB inaccessible.

Error log:

2021-04-21T04:56:39.729+0000 I COMMAND [ftdc] serverStatus was very slow: { after basic: 2165, after asserts: 3087, after backgroundFlushing: 8785, after connections: 11612, after dur: 12922, after extra_info: 19620, after globalLock: 27972, after locks: 41890, after logicalSessionRecordCache: 51379, after network: 55947, after opLatencies: 62013, after opcounters: 67473, after opcountersRepl: 70586, after repl: 74168, after security: 78481, after storageEngine: 78629, after tcmalloc: 78629, after transactions: 78629, after transportSecurity: 78629, after wiredTiger: 78813, at end: 79004 }

Question :

how to troubleshoot further ?
Enabling verbose 5 logs does gives more information ?
Is it truly a memory issue ?
what's the next step to avoid this issue ?

Best Answer

That means, your server is overload. It can't even reply to the serverStatus command without delay.

Some people solved that by adding more hardware to their server. But, I think first of all you should check your queries and indexes, maybe you can optimize them.

Check out your queries:

db.currentOp()