SlideShare a Scribd company logo
It Ain't
Tasseography
  10 Key Performance
Indicators for MongoDB
10 Key MongoDB Performance Indicators
Kyle Banker
kyle@10gen.com
@hwaet
Questions about speed
MongoDB is a high-performance database, but
how do I know that I'm getting the best
performance?
We'll cover:
Tools

Performance Indicators

Remedies
Prelude: Tools
1. mongostat
10 Key MongoDB Performance Indicators
2. serverStatus
db.serverStatus();
{
  "host" : "arete.local",
  "version" : "1.9.0-pre-",
  "process" : "mongod",
  "uptime" : 619052
}
// Lots more stats....
3. Profiler
> db.setProfilingLevel(2)
{ "was" : 0, "slowms" : 100, "ok" : 1 }
> db.system.profile.find().sort({$natural: -1})
{ "ts" : ISODate("2011-05-24T14:20:09.711Z"),
  "info" : "query docs.spreadsheets reslen:257
            nscanned:1805535
            query: { query: {}, $explain: true }
            nreturned:1 1407ms",
  "millis" : 1407 }
4. Monitoring service
Nagios

Munin

MMS
Indicators
1. Slow ops
Here's how they appear in the log:

 Sun May 22 19:01:47 [conn10]
   query docs.spreadsheets ntoreturn:100 reslen:510436
   nscanned:19976 { username: "Minner, Cori" }
   nreturned:100 147ms
2. Replication lag
test-rs:PRIMARY> rs.status()
{
  "set" : "test-rs",
  "date" : ISODate("2011-05-24T14:19:35Z"),
  "myState" : 1,
  "members" : [
    {
      "_id" : 0,
      "name" : "localhost:30000",
      "stateStr" : "PRIMARY",

      "optimeDate" : ISODate("2011-05-18T19:19:26Z"),
    },
    {
      "_id" : 1,
      "name" : "localhost:30001",
      "stateStr" : "SECONDARY",

        "optimeDate" : ISODate("2011-05-22T14:14:29Z"),
    }
}
3. Resident
  memory
> db.serverStatus().mem
{
  "bits" : 64,          //   Need 64, not 32
  "resident" : 7151,    //   Physical memory
  "virtual" : 14248,    //   Files + heap
  "mapped" : 6942       //   Datafiles
}
Virtual Memory   Physical
(Per Process)    Memory




                 RAM



                 Disk
use docs
> db.stats()
{
  "db" : "docs",
  "collections" : 3,
  "objects" : 805543,
  "avgObjSize" : 5107.312096312674,
  "dataSize" : 4114159508,        //   ~4GB
  "storageSize" : 4282908160,     //   ~4GB
  "numExtents" : 33,
  "indexes" : 3,
  "indexSize" : 126984192,        //   ~126MB
  "fileSize" : 8519680000,        //   ~8.5GB
  "ok" : 1
}
Note: fileSize include pre-allocation.
storageSize + indexSize =
          ~5GB
4. Page faults
> db.serverStatus().extra_info
{
  "note" : "fields vary by platform",
  "heap_usage_bytes" : 210656,
  "page_faults" : 2381
}
5. Write-lock
percentage
> db.serverStatus().globalLock
{
  "totalTime" : 194616196335,
  "lockTime" : 53865711,
  "ratio" : 0.000276779178785711,
}
Concurrency
One writer OR many readers.

Global.

Yields on long-running ops.
ΔlockTime / ΔtotalTime
(web console)
High lock percentage?
You're probably paging.
6. Reader- and
 writer-queues
> db.serverStatus().globalLock
"globalLock" : {
    "totalTime" : 430154769,
    "lockTime" : 17547681,
    "ratio" : 0.0407938776101306,
    "currentQueue" : {
       "total" : 1,
       "readers" : 1,
       "writers" : 0
    },
    "activeClients" : {
       "total" : 2,
       "readers" : 1,
       "writers" : 1
    }
}
> db.currentOp()
{
  "inprog" : [
    {
      "opid" : 194285,
      "active" : true,
      "lockType" : "read",
      "waitingForLock" : true,
      "secs_running" : 0,
      "op" : "query",
      "ns" : "docs.spreadsheets",
      "query" : {
        "username" : "Auxier, Han"
      },
      "client" : "127.0.0.1:64918",
      "desc" : "conn"
    }
  ]
}
If you have dozens of ops
waiting for locks, you've got
         a problem.
7. Background
    flushing
> db.serverStatus().backgroundFlushing
{
  "flushes" : 5634,
  "total_ms" : 83556,
  "average_ms" : 14.830670926517572,
  "last_ms" : 4,
  "last_finished" : ISODate("2011-05-24T14:30:00.863Z")
}
10 Key MongoDB Performance Indicators
Disk considerations
RAID

SSD

SAN?
8. Connections
> db.serverStatus().connections
{ "current" : 2, "available" : 202 }
9. Network bytes in
      and out
> db.serverStatus().network
{ "bytesIn" : 1132782538, "bytesOut" : 5181752122
10. Fragmentation
> db.spreadsheets.stats()
{
  "ns" : "docs.spreadsheets",

    "size" : 8200046932, // 8GB
    "storageSize" : 11807223808, // 11GB
    // Extra space for new documents.
    "paddingFactor" : 1.4302,

    // Does index size seem reasonable?
    "totalIndexSize" : 345964544,
    "indexSizes" : {
      "_id_" : 66772992,
      "username_1_filename_1" : 146079744,
      "username_1_updated_at_1" : 133111808
    },
    "ok" : 1
}
The magic number is: 2
storageSize / size < 2
Is it greater than 2?
Might not be reclaiming free space as
quickly as needed.

Padding might not be correctly
calibrated.

db.runCommand({compact: 1})
paddingFactor < 2
Is it greater than 2?
You might have the wrong data model.

Too many growing embedded
documents?

See MongoDB Schema Design.
Compact command
// In MongoDB 1.9+
db.runCommand({ compact : 'spreadsheets' });
Summary

More Related Content

PDF
S03_まずはここから!Microsoft 365 E3 でセキュリティの第一歩を踏み出す [Microsoft Japan Digital Days]
PDF
Insight into Azure Active Directory #02 - Azure AD B2B Collaboration New Feat...
PDF
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
PPTX
AzureDevOpsで始めるAndroidのCI/CD
PDF
Microservices DevOps on Google Cloud Platform
PDF
IT エンジニアのための 流し読み Microsoft 365 - 入門!Microsoft Defender ATP
PDF
Testowanie. Wprowadzenie do testowania oprogramowania.
PDF
Oracle Cloud Infrastructure:2023年2月度サービス・アップデート
S03_まずはここから!Microsoft 365 E3 でセキュリティの第一歩を踏み出す [Microsoft Japan Digital Days]
Insight into Azure Active Directory #02 - Azure AD B2B Collaboration New Feat...
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
AzureDevOpsで始めるAndroidのCI/CD
Microservices DevOps on Google Cloud Platform
IT エンジニアのための 流し読み Microsoft 365 - 入門!Microsoft Defender ATP
Testowanie. Wprowadzenie do testowania oprogramowania.
Oracle Cloud Infrastructure:2023年2月度サービス・アップデート

What's hot (20)

PDF
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.2.0対応)
PDF
katalon studio 툴을 이용한 GUI 테스트 자동화 가이드
PDF
ソフトウェア設計における 意思決定とそのレビューの秘訣
PDF
Security Development Lifecycle Tools
PDF
MongoDB Performance Tuning
PPTX
PPTX
今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門
PDF
FIDO in Windows10
PDF
[GKE & Spanner 勉強会] GKE 入門
PDF
Database in Kubernetes: Diagnostics and Monitoring
PPTX
ミクシィ 21卒向け Android研修
PDF
Bug Bash - Uma estratégia colaborativa de testes - Raquel Doná
PPTX
『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법
PPTX
STLC-ppt-1.pptx
PDF
Linux Container Technology 101
PDF
AWSにおけるIaCを活かしたTerraformの使い方2選! ~循環型IaCとマルチクラウドチックなDR環境~ (HashiTalks: Japan 発...
PDF
Standard Edition 2でも使えるOracle Database 12c Release 2オススメ新機能
PPT
Domain Driven Design (DDD)
PDF
Git & ブランチモデルで学ぶ バージョン管理入門
DOCX
Branching and merging strategy
FIWARE Orion Context Broker コンテキスト情報管理 (Orion 2.2.0対応)
katalon studio 툴을 이용한 GUI 테스트 자동화 가이드
ソフトウェア設計における 意思決定とそのレビューの秘訣
Security Development Lifecycle Tools
MongoDB Performance Tuning
今さら聞けない! Windows Server 2016 Active Directoryドメインサービス入門
FIDO in Windows10
[GKE & Spanner 勉強会] GKE 入門
Database in Kubernetes: Diagnostics and Monitoring
ミクシィ 21卒向け Android研修
Bug Bash - Uma estratégia colaborativa de testes - Raquel Doná
『이펙티브 디버깅』 - 디버깅 지옥에서 탈출하는 66가지 전략과 기법
STLC-ppt-1.pptx
Linux Container Technology 101
AWSにおけるIaCを活かしたTerraformの使い方2選! ~循環型IaCとマルチクラウドチックなDR環境~ (HashiTalks: Japan 発...
Standard Edition 2でも使えるOracle Database 12c Release 2オススメ新機能
Domain Driven Design (DDD)
Git & ブランチモデルで学ぶ バージョン管理入門
Branching and merging strategy
Ad

Viewers also liked (20)

PDF
mongoDB Performance
PDF
How to monitor MongoDB
PPTX
MongoDB Performance Tuning and Monitoring
PPTX
Concurrency Patterns with MongoDB
PDF
Playing in Tune: How We Refactored Cube to Terabyte Scale
PDF
MongoDB 3.0 and WiredTiger (Event: An Evening with MongoDB Dallas 3/10/15)
PPT
Geolocation and Cassandra at Physi
PPTX
Concurrency Control in MongoDB 3.0
PDF
Mongo performance tuning: tips and tricks
PPTX
Tuning Linux for MongoDB
PDF
Mining AWR V2 - Trend Analysis
PDF
Node.js - async for the rest of us.
PPTX
NoSQL and SOA
PPT
Oracle Event Delivery Network (EDN) of SOA Suite 11g
PDF
How_to_build_GameServer_2
PDF
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
PPTX
Review Oracle OpenWorld 2015 - Overview, Main themes, Announcements and Future
PPTX
The True State of the Oracle Public Cloud - Dutch Oracle Architects Platform ...
PPTX
Systems on the edge - your stepping stones into Oracle Public PaaS Cloud - AM...
PDF
AMIS Oracle OpenWorld 2013 Review Part 1 - Intro Overview Innovation, Hardwar...
mongoDB Performance
How to monitor MongoDB
MongoDB Performance Tuning and Monitoring
Concurrency Patterns with MongoDB
Playing in Tune: How We Refactored Cube to Terabyte Scale
MongoDB 3.0 and WiredTiger (Event: An Evening with MongoDB Dallas 3/10/15)
Geolocation and Cassandra at Physi
Concurrency Control in MongoDB 3.0
Mongo performance tuning: tips and tricks
Tuning Linux for MongoDB
Mining AWR V2 - Trend Analysis
Node.js - async for the rest of us.
NoSQL and SOA
Oracle Event Delivery Network (EDN) of SOA Suite 11g
How_to_build_GameServer_2
MongoDB performance tuning and load testing, NOSQL Now! 2013 Conference prese...
Review Oracle OpenWorld 2015 - Overview, Main themes, Announcements and Future
The True State of the Oracle Public Cloud - Dutch Oracle Architects Platform ...
Systems on the edge - your stepping stones into Oracle Public PaaS Cloud - AM...
AMIS Oracle OpenWorld 2013 Review Part 1 - Intro Overview Innovation, Hardwar...
Ad

Similar to 10 Key MongoDB Performance Indicators (20)

PDF
MongoDB: Optimising for Performance, Scale & Analytics
PDF
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
PPTX
High Performance, Scalable MongoDB in a Bare Metal Cloud
PDF
MySQL flexible schema and JSON for Internet of Things
PDF
Javantura v2 - Replication with MongoDB - what could go wrong... - Philipp Krenn
PPTX
Building and Scaling Node.js Applications
PPTX
DZone Java 8 Block Buster: Query Databases Using Streams
PDF
10 things i wish i'd known before using spark in production
PDF
Maintenance for MongoDB Replica Sets
PPTX
Become a Java GC Hero - All Day Devops
PDF
Apache Cassandra at Macys
PDF
Monitoreo de MySQL y PostgreSQL con SQL
PDF
Monitoring with Prometheus
PDF
Null Bachaav - May 07 Attack Monitoring workshop.
PDF
Original slides from Ryan Dahl's NodeJs intro talk
PPTX
Back to Basics Webinar 2: Your First MongoDB Application
PPTX
Back to Basics Webinar 2 - Your First MongoDB Application
PPTX
Deployment Preparedness
PDF
Superficial mongo db
PPTX
It's 10pm: Do You Know Where Your Writes Are?
MongoDB: Optimising for Performance, Scale & Analytics
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
High Performance, Scalable MongoDB in a Bare Metal Cloud
MySQL flexible schema and JSON for Internet of Things
Javantura v2 - Replication with MongoDB - what could go wrong... - Philipp Krenn
Building and Scaling Node.js Applications
DZone Java 8 Block Buster: Query Databases Using Streams
10 things i wish i'd known before using spark in production
Maintenance for MongoDB Replica Sets
Become a Java GC Hero - All Day Devops
Apache Cassandra at Macys
Monitoreo de MySQL y PostgreSQL con SQL
Monitoring with Prometheus
Null Bachaav - May 07 Attack Monitoring workshop.
Original slides from Ryan Dahl's NodeJs intro talk
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2 - Your First MongoDB Application
Deployment Preparedness
Superficial mongo db
It's 10pm: Do You Know Where Your Writes Are?

More from iammutex (20)

PDF
Scaling Instagram
PPT
Redis深入浅出
PDF
深入了解Redis
PDF
NoSQL误用和常见陷阱分析
PDF
MongoDB 在盛大大数据量下的应用
PPT
8 minute MongoDB tutorial slide
PPT
skip list
PDF
Thoughts on Transaction and Consistency Models
PPTX
Rethink db&tokudb调研测试报告
PDF
redis 适用场景与实现
PDF
Introduction to couchdb
PPTX
What every data programmer needs to know about disks
PDF
Ooredis
PDF
Ooredis
PDF
redis运维之道
PDF
Realtime hadoopsigmod2011
PDF
[译]No sql生态系统
PDF
Couchdb + Membase = Couchbase
PDF
Redis cluster
PDF
Redis cluster
Scaling Instagram
Redis深入浅出
深入了解Redis
NoSQL误用和常见陷阱分析
MongoDB 在盛大大数据量下的应用
8 minute MongoDB tutorial slide
skip list
Thoughts on Transaction and Consistency Models
Rethink db&tokudb调研测试报告
redis 适用场景与实现
Introduction to couchdb
What every data programmer needs to know about disks
Ooredis
Ooredis
redis运维之道
Realtime hadoopsigmod2011
[译]No sql生态系统
Couchdb + Membase = Couchbase
Redis cluster
Redis cluster

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Machine Learning_overview_presentation.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
cuic standard and advanced reporting.pdf
PPTX
A Presentation on Artificial Intelligence
PPTX
Big Data Technologies - Introduction.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation theory and applications.pdf
PPT
Teaching material agriculture food technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Machine Learning_overview_presentation.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Diabetes mellitus diagnosis method based random forest with bat algorithm
MIND Revenue Release Quarter 2 2025 Press Release
cuic standard and advanced reporting.pdf
A Presentation on Artificial Intelligence
Big Data Technologies - Introduction.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Spectral efficient network and resource selection model in 5G networks
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
Teaching material agriculture food technology
Advanced methodologies resolving dimensionality complications for autism neur...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Approach and Philosophy of On baking technology
Digital-Transformation-Roadmap-for-Companies.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Review of recent advances in non-invasive hemoglobin estimation
Agricultural_Statistics_at_a_Glance_2022_0.pdf

10 Key MongoDB Performance Indicators