Use and command explanation of mongodb monitoring tool mongostat

  • 2020-11-18 06:32:48
  • OfStack

mongostat is a status-detection tool that comes with mongodb. When used from the command line, it will obtain the current running state of mongodb at fixed intervals and output it.

1. Common command format of mongostat:

mongostat --host 192.168.11.11:27017 --username root --password 12345678 --authenticationDatabase admin

mongostat parameter Description:

--host: Specify the IP address and port, or just write IP, and then use the --port parameter to specify the port number
username: If authentication is enabled, you need to fill in the user name after it
password: Not much, it must be a password
--authenticationDatabase: If authentication is enabled, you need to fill in the authentication library after this parameter (note the database that authenticates the above account)

Command output format

2. Explanation of Each Field:

insert/s: The official interpretation is the number of objects inserted into the database per second. If it is slave, the number is preceded by *, indicating a replication set operation
query/s: number of query operations per second
update/s: Update operations per second
delete/s: Number of delete operations per second
getmore/s: getmore operands per second when cursor(cursor) is queried
command: number of commands executed per second. Two values (e.g. 3|0) are displayed on the master-slave system. The sub-table represents the local | copy command

Note: The number of commands executed within 1 second, such as batch insert, is only considered as 1 command (so it should not make much sense).

dirty: For the WiredTiger engine only, the website explains the percentage of dirty bytes cached
used: for the WiredTiger engine only, the website explains the percentage of caches in use

flushes:

For WiredTiger engine: refers to the number of checkpoint triggers during 1 polling interval
For MMAPv1 engine: Number of times per second that fsync executes to write data to hard disk

Note: 1 is usually 0, but the interval will be 1. By calculating the interval between 2 ones, we can get a general idea of how long flush1 is. flush is expensive, and if you frequent flush, you might want to find out why

vsize: Virtual memory usage, in units MB (this is the total number of the last call to mongostat)
res: physical memory usage, per MB (this is the total number of last calls to mongostat)

Note: This will not change much as you saw with top, vsize1. res will slowly rise. If res often drops suddenly, check to see if there are other programs that use a lot of memory.

qr: The length of the queue where the client is waiting to read data from an instance of MongoDB
qw: The length of the queue where the client is waiting to write data from an instance of MongoDB
ar: Number of active clients performing read operations
aw: Number of live clients performing write operations

Note: If these two Numbers are large, then DB is blocked and DB is not processing as fast as the request. See if there are expensive slow queries. If query 1 cut is normal, it is really a heavy load, you need to add a machine

netIn: Network incoming traffic for an MongoDB instance
netOut: Network outgoing traffic for MongoDB instance

Note: These two fields table name network bandwidth pressure, 1 in general, does not become a bottleneck

conn: the total number of open the connection, it is qr, qw, ar, aw combined

Note: MongoDB creates 1 thread for each connection, and the creation and release of the thread will also incur costs, so try to properly configure the startup parameters of the number of connections. maxIncomingConnections is suggested by Ali engineers to be below 5000, which basically meets most scenarios


Related articles: