Status
serverStatus returns seventeen counters and the uptime. They move as commands run.
Counters are updated on the command path. serverStatus returns the current values.
db.runCommand({ serverStatus: 1 })
Run that against a server that is already listening. One insert, one indexed find, and one scan each move a counter.
The counters
| Field | What it counts |
|---|---|
queries | find, count, aggregate, search, and sql |
inserts | insert commands |
updates | update commands |
deletes | delete commands |
connectionsActive | sockets open now |
connectionsTotal | sockets accepted since start |
bytesIn bytesOut | bytes read from clients, bytes written to clients |
walWrites | log records appended |
bufferPoolHits | page fetches served from RAM |
bufferPoolMisses | page fetches read from disk |
bufferPoolEvictions | pages dropped from the pool |
indexLookups | plans that used IDHACK or IXSCAN |
collectionScans | plans that walked the pages (COLLSCAN) |
transactionsStarted | beginTransaction |
transactionsCommitted | commitTransaction |
transactionsAborted | abortTransaction, including timeout |
The reply also includes uptime. A rising bufferPoolMisses means finds are reading pages from disk, which is expected once the collection is larger than the pool. A rising collectionScans next to a predicate you run often is a hint to add the index on Indexes.
Connections
max_connections in kova.toml caps how many clients can be connected. The default is 128. The socket past the cap gets an error and is closed, and it does not increment connectionsActive. Each accepted connection records the peer address, the start time, and the authenticated user when security is on. max_connection_idle_ms closes a connection that has sent nothing for that long. 0 leaves idle connections open. Shutdown, and disabling a user, close the matching connections and free the slots.