1.

What are the different situations when we should consider sharding over replication?

Answer»

In MongoDB data set consistency is ensured by locking. In any database system long running queries DEGRADE the performance as requests and operations have to wait for a lock. Locking issues are INTERMITTENT and so need to be resolved immediately.

MongoDB provides US with tools and utilities to troubleshoot these locking issues. The serverStatus() command provides us a view of the system including the locking-related information. We should look for locks and a globalLock section of serverStatus() command for TROUBLESHOOTING locking issues.

We can use below commands to filter locking related information from the serverStatus output.

db.serverStatus().globalLock db.serverStatus().locks

To get the approximate average wait time for a lock mode we can divide locks. timeAcquiringMicros by locks.acquireWaitCount.

To check the number of times deadlocks occurred locks.deadlockCount should be checked.

If the application performance is constantly degraded there might be concurrency issues, in such cases, we should look at globalLock.currentQueue.total. A high value INDICATES concurrency issues.

Sometimes globalLock.totalTime is high relative to uptime which suggests database has been in a lock state for a significant time.



Discussion

No Comment Found