[JAVA-613] Expand connection pool JMX stats to include the current operation being executed by each in use connection Created: 31/Jul/12  Updated: 29/Aug/12  Resolved: 02/Aug/12

Status: Closed
Project: Java Driver
Component/s: Monitoring
Affects Version/s: None
Fix Version/s: 2.9.0

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

It should include:

  1. the db/collection name
  2. the operation type (update/insert/query/etc)
  3. the query (for update/remove/query)


 Comments   
Comment by Jeffrey Yemin [ 29/Aug/12 ]

Closing as part of 2.9.0 release process.

Comment by auto [ 16/Aug/12 ]

Author:

{u'date': u'2012-08-16T06:10:54-07:00', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-613: Added some Javadoc
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/329c427d7e82e917a7f8c078d64ed60ab4557c84

Comment by auto [ 04/Aug/12 ]

Author:

{u'date': u'2012-08-04T06:03:56-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-613: Changing synchronized to volatile for integer only modified by one thread
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/8fd4c132850406b67c77e1870531ca5f389b9862

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-08-01T20:28:45-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-613: Added numDocuments property to InUseConnectionInfo to provide more info for batch inserts
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/74307b6cb63cfdd33b5c4de3e8aae1643b164852

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-08-01T20:14:28-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-613: Made OutMessage mostly immutable (except for the buffer) so that it can safely be examined via JMX
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/481fe05979e660f6c656fe13c50b5ac62f9bce71

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-08-01T11:51:17-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-613: some more java doc
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/d4584d9c9c6e689d54e3420504085e44380709aa

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-07-31T10:44:07-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-613: Added support for host, port, and local port to JMX connection pool mbean
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/70d5c8a50d28e3b19828358b25bf99cb03261554

Comment by auto [ 02/Aug/12 ]

Author:

{u'date': u'2012-07-31T04:48:05-07:00', u'email': u'jeff.yemin@10gen.com', u'name': u'Jeff Yemin'}

Message: JAVA-613: Expand connection pool JMX stats to include the current operation being executed by each in use connection. Did this by by using MXBean instean of MBean
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/c9d89107feff6417cf0ac47d7443ebd6c84893aa

Comment by Jeffrey Yemin [ 31/Jul/12 ]

Sample output of ConnectionPoolStat test program:

new-host-2:mongo-java-driver jeff$ java -cp mongo.jar com.mongodb.util.management.jmx.ConnectionPoolStat --help
View live MongoDB connection pool statistics from a remote JMX server.
 
usage: java com.mongodb.util.management.jmx.ConnectionPoolStat [options] [sleep time
sleep time: time to wait (in seconds) between calls. Defaults to 1
options:
  --help                 produce help message
  --port arg             JMX remote port. Required. Can also use --host hostname:port
  -h [ --host ] arg      JMX remote host. Defaults to localhost
  -n [ --rowcount ] arg  number of times to print stats (0 for indefinite)
 
Fields
  objectName                   - name of the JMX bean for this connection pool
  host                         - host of the mongod/mongos server
  port                         - port of the mongod/mongos server
  size                         - max # of connections allowed
  total                        - # of connections allocated
  inUse                        - # of connections in use
  inUseConnections             - list of all in use connections
  inUseConnections.namespace   - namespace on which connection is operating
  inUseConnections.opCode      - operation connection is executing
  inUseConnections.query       - query the connection is executing (for query/update/remove)
  inUseConnections.durationMS  - duration that the operation has been executing so far
  inUseConnections.localPort   - local port of the connection
 
new-host-2:mongo-java-driver jeff$ java -cp mongo.jar com.mongodb.util.management.jmx.ConnectionPoolStat -h localhost:9990 -n 2
{ pools : [
  { objectName: 'com.mongodb:type=ConnectionPool,host=localhost/127.0.0.1,port=27017,instance=1', 
    host: 'localhost', port: 27017, size: 4, total: 4, everCreated: 4, inUse: 4, 
    inUseConnections: [
      { namespace: 'FindContention.test', opCode: 'OP_QUERY', query: { }, durationMS: 674, localPort: 57991 }, 
      { namespace: 'FindContention.test', opCode: 'OP_QUERY', query: { }, durationMS: 725, localPort: 57990 }, 
      { namespace: 'FindContention.test', opCode: 'OP_QUERY', query: { }, durationMS: 752, localPort: 57989 }, 
      { namespace: 'FindContention.test', opCode: 'OP_QUERY', query: { }, durationMS: 646, localPort: 57992 }
    ]
  }
]}
 
{ pools : [
  { objectName: 'com.mongodb:type=ConnectionPool,host=localhost/127.0.0.1,port=27017,instance=1', 
    host: 'localhost', port: 27017, size: 4, total: 4, everCreated: 4, inUse: 4, 
    inUseConnections: [
      { namespace: 'FindContention.test', opCode: 'OP_QUERY', query: { }, durationMS: 438, localPort: 57991 }, 
      { namespace: 'FindContention.test', opCode: 'OP_QUERY', query: { }, durationMS: 1022, localPort: 57990 }, 
      { namespace: 'FindContention.test', opCode: 'OP_QUERY', query: { }, durationMS: 1015, localPort: 57989 }, 
      { namespace: 'FindContention.test', opCode: 'OP_QUERY', query: { }, durationMS: 402, localPort: 57992 }
    ]
  }
]}

Comment by Scott Hernandez (Inactive) [ 31/Jul/12 ]

Yeah, I was thinking this would be on a different bean not the pool. That should be fine but having to parse the name could be annoying and combersome.

Comment by Jeffrey Yemin [ 31/Jul/12 ]
  1. The server is part of the ObjectName of the MBean.
  2. I assume you mean the socket client port? Anything else?
Comment by Scott Hernandez (Inactive) [ 31/Jul/12 ]

Include as well the server and socket, and readPrefs/WriteConcern.

Generated at Thu Feb 08 08:52:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.