Differences between revisions 2 and 3
Revision 2 as of 2020-04-12 07:05:26
Size: 874
Editor: PieterSmit
Comment:
Revision 3 as of 2020-04-19 22:08:32
Size: 1016
Editor: PieterSmit
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:

== Indicate in connection string to not use primary server in cluster ==
 * mongodb://user:pass@urls/db?readPreference=secondaryPreferred

MongoDb/Performance

Indicate in connection string to not use primary server in cluster

  • mongodb://user:pass@urls/db?readPreference=secondaryPreferred

Slow / Long running queries

  • * $ mongo 10.32.2.4 --authenticationDatabase admin --username test --password mypass
  • > db.currentOp()

  • > db.currentOp({"secs_running": {$gte: 3}})

  • Count documents in <db> <collection>

    • use <db>;

    • db.<collection>.count()

  • DB locks
    • > db.serverStatus().globalLock

    • > db.serverStatus().locks

  • DB version , want > 3.2 wiretiger document level locking

    • > db.version()

  • DB memory usage should be less than ram
    • > db.serverStatus().mem

    • > db.serverStatus().wiredTiger.cache

  • Check number of connections
    • db.serverStatus().connections
  • Check indexs on a collection
    • db.<collection>.getIndexes()

MongoDb/Performance (last edited 2020-05-14 18:10:41 by PieterSmit)