How-To
Running the MongoDB Profiler
customers experiencing swimlane platform performance problems may be asked to assist in gathering diagnostic data, including the identification of long running, poor performing mongodb queries this is done in mongodb admin clients (such as robo 3t and the mongo shell) as follows connect to the swimlane database use swimlane discard the contents of previous profiling sessions db system profile drop() enable the profiler making a thoughtful choice about what query duration to capture the following will cause only queries running longer than 2 seconds (2000 ms) to be captured db setprofilinglevel(2, { slowms 2000 }) demonstrate the problem symptom perform whatever operations are necessary within swimlane to re create the poor performance scenario while poor performance is ongoing use db system profile count() to see how quickly the collection db system profile is filling up it has a 1 mb maximum size, and so it will accommodate several hundred captured queries see below for instructions to increase this maximum size if needed stop the profiler (leave it running for 30 seconds after re creating the poor performance) db setprofilinglevel(0) export the entire system profile collection then, attach it to your support portal ticket step 1 set the namespace $ export ns=\<enter namespace here> step 2 identify which mongo pod is primary $ kubectl exec mongo 0 n $ns mongo u admin p authenticationdatabase admin ssl sslallowinvalidhostnames sslallowinvalidcertificates admin eval="rs ismaster();" | grep primary step 3 export the system profile collection in the example below, swimlane sw mongo 0 is primary $ kubectl exec mongo 0 n $ns /bin/bash c "mongoexport u admin p authenticationdatabase admin ssl sslallowinvalidcertificates db swimlane collection system profile" > /tmp/system profile data mongo json submit /tmp/system profile data mongo json to support it may be necessary to repeat the above procedure several times to ensure that the poorest performing queries are captured for analysis keep these tips in mind as directed by swimlane support, it may be necessary to alter the slowms parameter in step 3 reduce slowms if no queries are being captured increase slowms if too many queries are being captured alternately, increase the maximum size limit of db system profile by issuing this command, db createcollection( "system profile", { capped true, size 4000000 } ) , after step 2 and before step 3 for more information, see https //docs mongodb com/manual/tutorial/manage the database profiler/ section change size of system profile collection on the primary