02 April,2020 by Rambler
Find a list of "out of the box" command line tools , used to gather MongoDB database and server data. This information can be used to identify bottlenecks for troubleshooting performance issues.This list only begins to touch upon sources of MongoDB data.
MongoDB database sizes are growing ,requiring new strategies for maintaining MongoDB performance.
Benchmarking query response times and other indicators serves as a basis to database performance. Predictability is the key to scalability
A performance strategy should include a) best practises for deploying MongoDB servers & b)a SYSTEMATIC tuning process & c) Asking the right questions
My general steps for MongoDB performance tuning. These will vary according to the specific circumstances.
=> STEP 1 : Application level
Check for the data model
Checking code patterns. client-side caching,bulk operations
Tune aggregation pipelines
Indexing . Sub - optimal or lack of indexing can lead to poor execution plans
=> STEP 2: MongoDB server
Write & Read configuration
Review cluster - Replica set setup and Sharding
=>STEP 3: Memory tuning to decrease IO
Wired Tiger Cache tuning
=> STEP 4 : IO Subsystem
Disk latency,SAN performance,Storage and IO performance considerations
1) mongostat - is like the vmstat tool. The default columns returned are :
insert query update delete getmore command dirty used flushes vsize res qrw arw net_in net_out conn set repl time
This is an effective to get a quick overview on database activity
Example command line
mongostat -u "myrootadmin" -p 'mypw' --authenticationDatabase "admin"
2) mongotop - returns a recordset every second, with a breakdown of the read and write activity across different objects.
Example command line
mongotop -u "myrootadmin" -p 'mypw' --authenticationDatabase "admin"
3) mongo shell serverStatus commands
>>db.serverStatus().globalLock
Example output
{
"totalTime" : NumberLong("4813615210000"),
"currentQueue" : {
"total" : 0,
"readers" : 0,
"writers" : 0
},
"activeClients" : {
"total" : 69,
"readers" : 0,
"writers" : 0
}
}
>>db.serverStatus().locks
Example Output
{
"Global" : {
"acquireCount" : {
"r" : NumberLong(109089975),
"w" : NumberLong(606648),
"W" : NumberLong(10)
},
"acquireWaitCount" : {
"r" : NumberLong(1)
},
"timeAcquiringMicros" : {
"r" : NumberLong(609)
}
},
"Database" : {
"acquireCount" : {
"r" : NumberLong(70363356),
"w" : NumberLong(119903),
"R" : NumberLong(4),
"W" : NumberLong(42)
}
},
"Collection" : {
"acquireCount" : {
"r" : NumberLong(43656178),
"w" : NumberLong(119900),
"W" : NumberLong(1)
}
},
"oplog" : {
"acquireCount" : {
"r" : NumberLong(26764027),
"w" : NumberLong(4)
}
}
}
>>db.serverStatus().mem
Example output
{
"bits" : 64,
"resident" : 223,
"virtual" : 1850,
"supported" : true,
"mapped" : 0,
"mappedWithJournal" : 0
}
>>db.serverStatus().wiredTiger.cache
Example output
{
"application threads page read from disk to cache count" : 70,
"application threads page read from disk to cache time (usecs)" : 11361,
"application threads page write from cache to disk count" : 635261,
"application threads page write from cache to disk time (usecs)" : 42658285,
"bytes belonging to page images in the cache" : 194830,
"bytes belonging to the cache overflow table in the cache" : 182,
"bytes currently in the cache" : 155919594,
"bytes dirty in the cache cumulative" : 382852382227,
"bytes not belonging to page images in the cache" : 155724763,
"bytes read into cache" : 603568,
"bytes written from cache" : 4796372922,
"cache overflow cursor application thread wait time (usecs)" : 0,
"cache overflow cursor internal thread wait time (usecs)" : 0,
"cache overflow score" : 0,
"cache overflow table entries" : 0,
"cache overflow table insert calls" : 0,
"cache overflow table max on-disk size" : 0,
"cache overflow table on-disk size" : 0,
"cache overflow table remove calls" : 0,
"checkpoint blocked page eviction" : 0,
"eviction calls to get a page" : 16258,
"eviction calls to get a page found queue empty" : 16249,
"eviction calls to get a page found queue empty after locking" : 0,
"eviction currently operating in aggressive mode" : 0,
"eviction empty score" : 0,
"eviction passes of a file" : 0,
"eviction server candidate queue empty when topping up" : 0,
"eviction server candidate queue not empty when topping up" : 0,
"eviction server evicting pages" : 0,
"eviction server slept, because we did not make progress with eviction" : 1432,
"eviction server unable to reach eviction goal" : 0,
"eviction state" : 64,
"eviction walk target pages histogram - 0-9" : 0,
"eviction walk target pages histogram - 10-31" : 0,
"eviction walk target pages histogram - 128 and higher" : 0,
"eviction walk target pages histogram - 32-63" : 0,
"eviction walk target pages histogram - 64-128" : 0,
"eviction walks abandoned" : 0,
"eviction walks gave up because they restarted their walk twice" : 0,
"eviction walks gave up because they saw too many pages and found no candidates" : 0,
"eviction walks gave up because they saw too many pages and found too few candidates" : 0,
"eviction walks reached end of tree" : 0,
"eviction walks started from root of tree" : 0,
"eviction walks started from saved location in tree" : 0,
"eviction worker thread active" : 4,
"eviction worker thread created" : 0,
"eviction worker thread evicting pages" : 9,
"eviction worker thread removed" : 0,
"eviction worker thread stable number" : 0,
"failed eviction of pages that exceeded the in-memory maximum count" : 18,
"failed eviction of pages that exceeded the in-memory maximum time (usecs)" : 23,
"files with active eviction walks" : 0,
"files with new eviction walks started" : 0,
"force re-tuning of eviction workers once in a while" : 0,
"hazard pointer blocked page eviction" : 6,
"hazard pointer check calls" : 95,
"hazard pointer check entries walked" : 199,
"hazard pointer maximum array length" : 2,
"in-memory page passed criteria to be split" : 31,
"in-memory page splits" : 15,
"internal pages evicted" : 15,
"internal pages split during eviction" : 0,
"leaf pages split during eviction" : 0,
"maximum bytes configured" : 3590324224,
"maximum page size at eviction" : 0,
"modified pages evicted" : 34,
"modified pages evicted by application threads" : 0,
"operations timed out waiting for space in cache" : 0,
"overflow pages read into cache" : 0,
"page split during eviction deepened the tree" : 0,
"page written requiring cache overflow records" : 0,
"pages currently held in the cache" : 93,
"pages evicted because they exceeded the in-memory maximum count" : 15,
"pages evicted because they exceeded the in-memory maximum time (usecs)" : 815,
"pages evicted because they had chains of deleted items count" : 53,
"pages evicted because they had chains of deleted items time (usecs)" : 13791,
"pages evicted by application threads" : 0,
"pages queued for eviction" : 0,
"pages queued for urgent eviction" : 10,
"pages queued for urgent eviction during walk" : 0,
"pages read into cache" : 98,
"pages read into cache after truncate" : 25,
"pages read into cache after truncate in prepare state" : 0,
"pages read into cache requiring cache overflow entries" : 0,
"pages read into cache requiring cache overflow for checkpoint" : 0,
"pages read into cache skipping older cache overflow entries" : 0,
"pages read into cache with skipped cache overflow entries needed later" : 0,
"pages read into cache with skipped cache overflow entries needed later by checkpoint" : 0,
"pages requested from the cache" : 89116580,
"pages seen by eviction walk" : 0,
"pages selected for eviction unable to be evicted" : 18,
"pages walked for eviction" : 0,
"pages written from cache" : 635264,
"pages written requiring in-memory restoration" : 0,
"percentage overhead" : 8,
"tracked bytes belonging to internal pages in the cache" : 56724,
"tracked bytes belonging to leaf pages in the cache" : 155862870,
"tracked dirty bytes in the cache" : 7993694,
"tracked dirty pages in the cache" : 2,
"unmodified pages evicted" : 28
}
Read more on Database Server Tuning
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |