Reactive Scala Driver for MongoDB
Asynchronous & Non-Blocking
Monitoring
ReactiveMongo provides a mechanism to collect some metrics about MongoDB connections, that can be useful to monitor.
JMX
A JMX module is available.
When running with this module, you can check the state of the ReactiveMongo pools from outside the JVM, using a JMX client.
It can be enabled by adding the dependency as bellow.
"org.reactivemongo" %% "reactivemongo-jmx" % "0.20.13"
Using JConsole:
In order to monitor with jconsole
, first start it and select the ReactiveMongo JVM.
The following warning may be display when connecting to a JVM without SSL (e.g. for local JVMs).
Once connected, you can select the “MBeans” tab on the top of JConsole, to check the beans managed in the JVM, including those representing the MongoDB nodes managed by ReactiveMongo.
The collected metrics are the following.
Pool metrics: (tagged by pool name)
reactivemongo.awaitingRequests
: Total number of requests awaiting to be processed by MongoDB nodes.reactivemongo.maxAwaitingRequestsPerChannel
: Maximum number of requests that were awaiting to be processed for a single channel (seemaxInFlightRequestsPerChannel
).reactivemongo.numberOfNodes
: Number of nodes that are part of the set.reactivemongo.hasPrimary
: Indicates whether the primary node is known (0 or 1).reactivemongo.hasNearest
: Indicates whether the nearest node is known (0 or 1).reactivemongo.isMongos
: Indicates whether mongos is used (0 or 1).reactivemongo.numberOfSecondaries
: Number of secondary nodes in the set. Node metrics: (tagged by pool & node)reactivemongo.nodeChannels
: Number of network channels to a same MongoDB node, whatever is the status (seeconnectedChannels
).reactivemongo.connectedChannels
: Number of connected channels to a same MongoDB node (seenodeChannels
).reactivemongo.authenticatedChannels
: Number of authenticated channels to a same MongoDB node (seeconnectedChannels
).reactivemongo.pingTime
: Response delay (in nanoseconds) for the last IsMaster request.