Skip to content

Performance Analytic

Ken Chen edited this page Nov 2, 2018 · 4 revisions

Performance Analytic

Beginning MongoDB 3.2, mongod servers write collected stats to files under diagnostic.data directory. Keyhole can read these files and print summaries. In addition, keyhole can start a web server and display charts. The usage is

keyhole [--web] --diag <file>|<directory>

For example, to read a file.

keyhole --diag /data/db/diagnostic.data/metrics.2018-10-06T10-20-22Z-00000

or to read all files from the diagnostic.data directory.

keyhole --diag /data/db/diagnostic.data

When --web flag is included, keyhole starts a web server and charts are available from port 5408.

The discussion of what these metrics represent is outside the scope of this user's guide. But experienced users should be able identify the performance bottlenecks from these summaries.

Analytic Summary

Analytic summary includes

  • Resident memory
  • Virtual memory
  • Page faults
  • Number of ops from Command
  • Number of ops from Delete
  • Number of ops from Getmore
  • Number of ops from Insert
  • Number of ops from Query
  • Number of ops from Update
  • IOPS

Page faults occurs when mongod has to retrieved data from disks because data was not found in the memory. High number of Page faults indicates the amount physical memory installed is not able to hold your working set. Adding additional memory or scaling MongoDB horizontally is recommended.

Global Lock Summary

Global lock includes

  • Total time in milliseconds
  • Active Client
  • Current Queue

Growing number of Current Queue indicates MongoDB is not processing requests fast enough as they arrive. Scaling up your server can help, such as fast CPU and disk, or scaling MongoDB horizontally by adding additional shards.

Latencies Summary

Latencies summary includes

  • reads latency in millisecond
  • writes latency in millisecond
  • commands latency in millisecond

Metrics Summary

Metrics summary includes

  • Scanned
  • ScannedObj
  • ScanAndOrder
  • WriteConflicts
  • Deleted
  • Inserted
  • Returned
  • Updated

Scanned designates the total number of index items scanned during queries and query-plan evaluation. ScannedObj indicates total number of documents scanned during queries and query-plan evaluation. ScanAndOrder means the total number of queries that return sorted numbers that cannot perform the sort operation using an index. Additional indexes can help if you have high numbers of ScannedObj or ScanAndOrder.

WiredTiger Cache Summary

WireTiger cache summary includes

  • MaxBytes Configured
  • Currently InCache
  • Tracked DirtyBytes
  • Modified PagesEvicted
  • Unmodified PagesEvicted
  • PagesRead IntoCache
  • PagesWritten FromCache

The value of Currently InCache should not be greater than the MaxBytes Configured value. Tracked DirtyBytes indicates data in the wiredTiger cache that has been modified but not yet flushed to disk, and should be less than the value of Currently in cache. Expanding amounts of dirty data represents a bottleneck where data is written to disk not fast enough. Modified PagesEvicted and Unmodified PagesEvicted reveal page eviction statistics. PagesRead IntoCache and PagesWritten FromCache provide an overview of the I/O activity.

WiredTiger Concurrent Transaction Summary

WireTiger cache summary includes

  • Read ticket
  • Write ticket

WiredTiger storage engine uses tickets to control the number of read/write operations simultaneously processed. When the number of available read or write tickets available reaches zero, new read or write requests are queued until a new read or write ticket is freed up.