MongoDB性能监控(5)--db.serverStatus()


  • 註冊用戶

    1、概述

    • 上一篇中介绍了db.stats()命令,这篇中将详细介绍db.serverStatus()命令;
    • db.serverStatus()命令的主要作用是查看服务器的运行状态;
    • db.serverStatus()与mongostat命令类似,db.serverStatus()提示的信息更加具体、全面;
    • db.serverStatus()命令查看的是静态数据,而mongostat命令查看的是实时的数据;
    • db.serverStatus()和db.runCommand({serverStatus: 1})命令功能一样;

    2、示例:

    • 执行db.serverStatus()命令得到的查询结果如下:
    <code>MongoDB shell version: 3.2.8
    connecting to: localhost:27017/admin
    {
        "host" : "ggnode2",        # 主机名
        "advisoryHostFQDNs" : [ ], 
        "version" : "3.2.8",       # 版本号
        "process" : "mongod",      # 进程(mongod或mongos)
        "pid" : NumberLong(23155),
        "uptime" : 1470624,
        "uptimeMillis" : NumberLong(1470624043),
        "uptimeEstimate" : 1415522,
        "localTime" : ISODate("2016-11-07T04:13:33.328Z"),
        "asserts" : {
            "regular" : 0,
            "warning" : 0,
            "msg" : 0,
            "user" : 62,
            "rollovers" : 0
        },
        "connections" : {
            "current" : 1,
            "available" : 818,
            "totalCreated" : NumberLong(6025)
        },
        "extra_info" : {
            "note" : "fields vary by platform",
            "heap_usage_bytes" : 60437840,
            "page_faults" : 28
        },
        "globalLock" : {
            "totalTime" : NumberLong("1470624234000"),
            "currentQueue" : {
                "total" : 0,
                "readers" : 0,
                "writers" : 0
            },
            "activeClients" : {
                "total" : 8,
                "readers" : 0,
                "writers" : 0
            }
        },
        "locks" : {
            "Global" : {
                "acquireCount" : {
                    "r" : NumberLong(4615078),
                    "w" : NumberLong(26),
                    "W" : NumberLong(4)
                },
                "acquireWaitCount" : {
                    "r" : NumberLong(1)
                },
                "timeAcquiringMicros" : {
                    "r" : NumberLong(17300)
                }
            },
            "Database" : {
                "acquireCount" : {
                    "r" : NumberLong(2307505),
                    "R" : NumberLong(19),
                    "W" : NumberLong(26)
                }
            },
            "Collection" : {
                "acquireCount" : {
                    "r" : NumberLong(2356509),
                    "w" : NumberLong(18)
                }
            },
            "Metadata" : {
                "acquireCount" : {
                    "w" : NumberLong(1)
                }
            }
        },
        "network" : {
            "bytesIn" : NumberLong(1271784),
            "bytesOut" : NumberLong(1177976),
            "numRequests" : NumberLong(12423)
        },
        "opcounters" : {
            "insert" : 0,
            "query" : 11,
            "update" : 18,
            "delete" : 0,
            "getmore" : 0,
            "command" : 12370
        },
        "opcountersRepl" : {
            "insert" : 0,
            "query" : 0,
            "update" : 0,
            "delete" : 0,
            "getmore" : 0,
            "command" : 0
        },
        "storageEngine" : {
            "name" : "wiredTiger",
            "supportsCommittedReads" : true,
            "persistent" : true
        },
        "tcmalloc" : {
            "generic" : {
                "current_allocated_bytes" : 60439376,
                "heap_size" : 68681728
            },
            "tcmalloc" : {
                "pageheap_free_bytes" : 2048000,
                "pageheap_unmapped_bytes" : 1286144,
                "max_total_thread_cache_bytes" : NumberLong(1073741824),
                "current_total_thread_cache_bytes" : 2271744,
                "central_cache_free_bytes" : 670384,
                "transfer_cache_free_bytes" : 1966080,
                "thread_cache_free_bytes" : 2271744,
                "aggressive_memory_decommit" : 0
            },
            "formattedString" : "------------------------------------------------\nMALLOC:       60439376 (   57.6 MiB) Bytes in use by application\nMALLOC: +      2048000 (    2.0 MiB) Bytes in page heap freelist\nMALLOC: +       670384 (    0.6 MiB) Bytes in central cache freelist\nMALLOC: +      1966080 (    1.9 MiB) Bytes in transfer cache freelist\nMALLOC: +      2271744 (    2.2 MiB) Bytes in thread cache freelists\nMALLOC: +      1208480 (    1.2 MiB) Bytes in malloc metadata\nMALLOC:   ------------\nMALLOC: =     68604064 (   65.4 MiB) Actual memory used (physical + swap)\nMALLOC: +      1286144 (    1.2 MiB) Bytes released to OS (aka unmapped)\nMALLOC:   ------------\nMALLOC: =     69890208 (   66.7 MiB) Virtual address space used\nMALLOC:\nMALLOC:            467              Spans in use\nMALLOC:             12              Thread heaps in use\nMALLOC:           8192              Tcmalloc page size\n------------------------------------------------\nCall ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).\nBytes released to the OS take up virtual address space but no physical memory.\n"
        },
        "wiredTiger" : {
            "uri" : "statistics:",
            "LSM" : {
                "application work units currently queued" : 0,
                "merge work units currently queued" : 0,
                "rows merged in an LSM tree" : 0,
                "sleep for LSM checkpoint throttle" : 0,
                "sleep for LSM merge throttle" : 0,
                "switch work units currently queued" : 0,
                "tree maintenance operations discarded" : 0,
                "tree maintenance operations executed" : 0,
                "tree maintenance operations scheduled" : 0,
                "tree queue hit maximum" : 0
            },
            "async" : {
                "current work queue length" : 0,
                "maximum work queue length" : 0,
                "number of allocation state races" : 0,
                "number of flush calls" : 0,
                "number of operation slots viewed for allocation" : 0,
                "number of times operation allocation failed" : 0,
                "number of times worker found no work" : 0,
                "total allocations" : 0,
                "total compact calls" : 0,
                "total insert calls" : 0,
                "total remove calls" : 0,
                "total search calls" : 0,
                "total update calls" : 0
            },
            "block-manager" : {
                "blocks pre-loaded" : 14,
                "blocks read" : 58,
                "blocks written" : 104,
                "bytes read" : 262144,
                "bytes written" : 589824,
                "mapped blocks read" : 0,
                "mapped bytes read" : 0
            },
            "cache" : {
                "bytes currently in the cache" : 154243,
                "bytes read into cache" : 83409,
                "bytes written from cache" : 214448,
                "checkpoint blocked page eviction" : 0,
                "eviction currently operating in aggressive mode" : 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 populating queue, but not evicting pages" : 0,
                "eviction server unable to reach eviction goal" : 0,
                "eviction worker thread evicting pages" : 0,
                "failed eviction of pages that exceeded the in-memory maximum" : 0,
                "files with active eviction walks" : 0,
                "files with new eviction walks started" : 0,
                "hazard pointer blocked page eviction" : 0,
                "in-memory page passed criteria to be split" : 0,
                "in-memory page splits" : 0,
                "internal pages evicted" : 0,
                "internal pages split during eviction" : 0,
                "leaf pages split during eviction" : 0,
                "lookaside table insert calls" : 0,
                "lookaside table remove calls" : 0,
                "maximum bytes configured" : 1073741824,
                "maximum page size at eviction" : 0,
                "modified pages evicted" : 0,
                "modified pages evicted by application threads" : 0,
                "page split during eviction deepened the tree" : 0,
                "page written requiring lookaside records" : 0,
                "pages currently held in the cache" : 25,
                "pages evicted because they exceeded the in-memory maximum" : 0,
                "pages evicted because they had chains of deleted items" : 0,
                "pages evicted by application threads" : 0,
                "pages queued for eviction" : 0,
                "pages queued for urgent eviction" : 0,
                "pages read into cache" : 24,
                "pages read into cache requiring lookaside entries" : 0,
                "pages seen by eviction walk" : 0,
                "pages selected for eviction unable to be evicted" : 0,
                "pages walked for eviction" : 0,
                "pages written from cache" : 52,
                "pages written requiring in-memory restoration" : 0,
                "percentage overhead" : 8,
                "tracked bytes belonging to internal pages in the cache" : 23374,
                "tracked bytes belonging to leaf pages in the cache" : 130869,
                "tracked bytes belonging to overflow pages in the cache" : 0,
                "tracked dirty bytes in the cache" : 2583,
                "tracked dirty pages in the cache" : 1,
                "unmodified pages evicted" : 0
            },
            "connection" : {
                "auto adjusting condition resets" : 38,
                "auto adjusting condition wait calls" : 4410074,
                "files currently open" : 16,
                "memory allocations" : 24360987,
                "memory frees" : 24360096,
                "memory re-allocations" : 5931383,
                "pthread mutex condition wait calls" : 19259828,
                "pthread mutex shared lock read-lock calls" : 3948538,
                "pthread mutex shared lock write-lock calls" : 2033557,
                "total read I/Os" : 510,
                "total write I/Os" : 145
            },
            "cursor" : {
                "cursor create calls" : 61,
                "cursor insert calls" : 42,
                "cursor next calls" : 2088,
                "cursor prev calls" : 8,
                "cursor remove calls" : 1,
                "cursor reset calls" : 600208,
                "cursor restarted searches" : 0,
                "cursor search calls" : 596264,
                "cursor search near calls" : 3892,
                "cursor update calls" : 0,
                "truncate calls" : 0
            },
            "data-handle" : {
                "connection data handles currently active" : 13,
                "connection sweep candidate became referenced" : 0,
                "connection sweep dhandles closed" : 0,
                "connection sweep dhandles removed from hash list" : 269589,
                "connection sweep time-of-death sets" : 269600,
                "connection sweeps" : 147048,
                "session dhandles swept" : 168270,
                "session sweep attempts" : 24525
            },
            "log" : {
                "busy returns attempting to switch slots" : 0,
                "consolidated slot closures" : 27,
                "consolidated slot join races" : 0,
                "consolidated slot join transitions" : 27,
                "consolidated slot joins" : 38,
                "consolidated slot unbuffered writes" : 0,
                "log bytes of payload data" : 12836,
                "log bytes written" : 16000,
                "log files manually zero-filled" : 0,
                "log flush operations" : 14653453,
                "log force write operations" : 16147909,
                "log force write operations skipped" : 16147894,
                "log records compressed" : 19,
                "log records not compressed" : 0,
                "log records too small to compress" : 19,
                "log release advances write LSN" : 12,
                "log scan operations" : 3,
                "log scan records requiring two reads" : 5,
                "log server thread advances write LSN" : 15,
                "log server thread write LSN walk skipped" : 1471010,
                "log sync operations" : 27,
                "log sync_dir operations" : 1,
                "log write operations" : 38,
                "logging bytes consolidated" : 15616,
                "maximum log file size" : 104857600,
                "number of pre-allocated log files to create" : 2,
                "pre-allocated log files not ready and missed" : 1,
                "pre-allocated log files prepared" : 2,
                "pre-allocated log files used" : 0,
                "records processed by log scan" : 9,
                "total in-memory size of compressed records" : 19473,
                "total log buffer size" : 33554432,
                "total size of compressed records" : 11899,
                "written slots coalesced" : 0,
                "yields waiting for previous log file close" : 0
            },
            "reconciliation" : {
                "fast-path pages deleted" : 0,
                "page reconciliation calls" : 52,
                "page reconciliation calls for eviction" : 0,
                "pages deleted" : 0,
                "split bytes currently awaiting free" : 0,
                "split objects currently awaiting free" : 0
            },
            "session" : {
                "open cursor count" : 24,
                "open session count" : 15
            },
            "thread-yield" : {
                "page acquire busy blocked" : 0,
                "page acquire eviction blocked" : 0,
                "page acquire locked blocked" : 0,
                "page acquire read blocked" : 0,
                "page acquire time sleeping (usecs)" : 0
            },
            "transaction" : {
                "number of named snapshots created" : 0,
                "number of named snapshots dropped" : 0,
                "transaction begins" : 101980,
                "transaction checkpoint currently running" : 0,
                "transaction checkpoint generation" : 24509,
                "transaction checkpoint max time (msecs)" : 33,
                "transaction checkpoint min time (msecs)" : 0,
                "transaction checkpoint most recent time (msecs)" : 0,
                "transaction checkpoint total time (msecs)" : 239,
                "transaction checkpoints" : 24509,
                "transaction failures due to cache overflow" : 0,
                "transaction range of IDs currently pinned" : 0,
                "transaction range of IDs currently pinned by a checkpoint" : 0,
                "transaction range of IDs currently pinned by named snapshots" : 0,
                "transaction sync calls" : 0,
                "transactions committed" : 17,
                "transactions rolled back" : 101963
            },
            "concurrentTransactions" : {
                "write" : {
                    "out" : 0,
                    "available" : 128,
                    "totalTickets" : 128
                },
                "read" : {
                    "out" : 0,
                    "available" : 128,
                    "totalTickets" : 128
                }
            }
        },
        "writeBacksQueued" : false,
        "mem" : {
            "bits" : 64,
            "resident" : 40,
            "virtual" : 390,
            "supported" : true,
            "mapped" : 0,
            "mappedWithJournal" : 0
        },
        "metrics" : {
            "commands" : {
                "authenticate" : {
                    "failed" : NumberLong(5981),
                    "total" : NumberLong(5981)
                },
                "buildInfo" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(20)
                },
                "dbStats" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(1)
                },
                "find" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(10)
                },
                "getLastError" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(18)
                },
                "getLog" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(3)
                },
                "getnonce" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(5996)
                },
                "grantRolesToUser" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(7)
                },
                "isMaster" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(190)
                },
                "listCollections" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(14)
                },
                "listDatabases" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(3)
                },
                "ping" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(7)
                },
                "replSetGetStatus" : {
                    "failed" : NumberLong(3),
                    "total" : NumberLong(3)
                },
                "revokeRolesFromUser" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(2)
                },
                "saslContinue" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(56)
                },
                "saslStart" : {
                    "failed" : NumberLong(8),
                    "total" : NumberLong(36)
                },
                "serverStatus" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(5)
                },
                "whatsmyuri" : {
                    "failed" : NumberLong(0),
                    "total" : NumberLong(28)
                }
            },
            "cursor" : {
                "timedOut" : NumberLong(0),
                "open" : {
                    "noTimeout" : NumberLong(0),
                    "pinned" : NumberLong(0),
                    "total" : NumberLong(0)
                }
            },
            "document" : {
                "deleted" : NumberLong(0),
                "inserted" : NumberLong(0),
                "returned" : NumberLong(30),
                "updated" : NumberLong(18)
            },
            "getLastError" : {
                "wtime" : {
                    "num" : 0,
                    "totalMillis" : 0
                },
                "wtimeouts" : NumberLong(0)
            },
            "operation" : {
                "fastmod" : NumberLong(0),
                "idhack" : NumberLong(0),
                "scanAndOrder" : NumberLong(0),
                "writeConflicts" : NumberLong(0)
            },
            "queryExecutor" : {
                "scanned" : NumberLong(18),
                "scannedObjects" : NumberLong(48)
            },
            "record" : {
                "moves" : NumberLong(0)
            },
            "repl" : {
                "executor" : {
                    "counters" : {
                        "eventCreated" : 0,
                        "eventWait" : 0,
                        "cancels" : 0,
                        "waits" : 0,
                        "scheduledNetCmd" : 0,
                        "scheduledDBWork" : 0,
                        "scheduledXclWork" : 0,
                        "scheduledWorkAt" : 0,
                        "scheduledWork" : 0,
                        "schedulingFailures" : 0
                    },
                    "queues" : {
                        "networkInProgress" : 0,
                        "dbWorkInProgress" : 0,
                        "exclusiveInProgress" : 0,
                        "sleepers" : 0,
                        "ready" : 0,
                        "free" : 0
                    },
                    "unsignaledEvents" : 0,
                    "eventWaiters" : 0,
                    "shuttingDown" : false,
                    "networkInterface" : "NetworkInterfaceASIO inShutdown: 0"
                },
                "apply" : {
                    "batches" : {
                        "num" : 0,
                        "totalMillis" : 0
                    },
                    "ops" : NumberLong(0)
                },
                "buffer" : {
                    "count" : NumberLong(0),
                    "maxSizeBytes" : 268435456,
                    "sizeBytes" : NumberLong(0)
                },
                "network" : {
                    "bytes" : NumberLong(0),
                    "getmores" : {
                        "num" : 0,
                        "totalMillis" : 0
                    },
                    "ops" : NumberLong(0),
                    "readersCreated" : NumberLong(0)
                },
                "preload" : {
                    "docs" : {
                        "num" : 0,
                        "totalMillis" : 0
                    },
                    "indexes" : {
                        "num" : 0,
                        "totalMillis" : 0
                    }
                }
            },
            "storage" : {
                "freelist" : {
                    "search" : {
                        "bucketExhausted" : NumberLong(0),
                        "requests" : NumberLong(0),
                        "scanned" : NumberLong(0)
                    }
                }
            },
            "ttl" : {
                "deletedDocuments" : NumberLong(0),
                "passes" : NumberLong(24508)
            }
        },
        "ok" : 1
    }
    </code>

    本帖部分内容已隐藏,请登入并回覆,以查看隐藏内容!

  • 註冊用戶

    学习一下。。。。。。。


  • 註冊用戶

    想看~快給我看~芝麻開門


  • Lv 1

    想學~~~芝麻開門


  • Lv 1

    @henryjia

    性能系列文章...收藏


  • 註冊用戶

    @henryjia111


  • 註冊用戶

    学习一下。。。。。。。


  • 註冊用戶

    thanks for you


  • 註冊用戶

    該功能訊息量蠻多的,真不知從何看起,感謝。


  • 註冊用戶

    学习一下,谢谢共享


  • 註冊用戶

    該功能訊息量蠻多的,真不知從何看起,感謝。


  • 註冊用戶

    学习

    ........


  • 註冊用戶

    O(∩_∩)O谢谢


  • 註冊用戶

    谢谢分享谢谢分享


  • 註冊用戶

    感谢分享

    看看实际内容再来评论。


  • 註冊用戶

    想學~~~芝麻開門


  • 註冊用戶

    @henryjia谢谢分享,看看有没有用


  • Lv 1

    学习一下,谢谢共享


  • 註冊用戶

    赶紧来学习学习~~~


登录后回复
 

与 萌阔论坛 的连接断开,我们正在尝试重连,请耐心等待