MongoDB Performance Tuning: Everything You Need to Know - Stackify - 0 views
-
db.serverStatus().globalLock
-
globalLock.currentQueue.total: This number can indicate a possible concurrency issue if it’s consistently high. This can happen if a lot of requests are waiting for a lock to be released.
- ...35 more annotations...
-
globalLock.totalTime: If this is higher than the total database uptime, the database has been in a lock state for too long.
-
Unlike relational databases such as MySQL or PostgreSQL, MongoDB uses JSON-like documents for storing data.
-
When a lock occurs, no other operation can read or modify the data until the operation that initiated the lock is finished.
-
Is the database frequently locking from queries? This might indicate issues with the schema design, query structure, or system architecture.
-
mem.resident: Roughly equivalent to the amount of RAM in megabytes that the database process uses
-
If mem.resident exceeds the value of system memory and there’s a large amount of unmapped data on disk, we’ve most likely exceeded system capacity.
-
If the value of mem.mapped is greater than the amount of system memory, some operations will experience page faults.
-
The WiredTiger storage engine is a significant improvement over MMAPv1 in performance and concurrency.
-
wiredTiger.cache.bytes currently in the cache – This is the size of the data currently in the cache.
-
wiredTiger.cache.tracked dirty bytes in the cache – This is the size of the dirty data in the cache.
-
we can look at the wiredTiger.cache.bytes read into cache value for read-heavy applications. If this value is consistently high, increasing the cache size may improve overall read performance.
-
check whether the application is read-heavy. If it is, increase the size of the replica set and distribute the read operations to secondary members of the set.
-
a particularly thorny problem if the lag between a primary and secondary node is high and the secondary becomes the primary
-
use the db.printSlaveReplicationInfo() or the rs.printSlaveReplicationInfo() command to see the status of a replica set from the perspective of the secondary member of the set.
-
shows how far behind the secondary members are from the primary. This number should be as low as possible.