Skip to main content
Version: 6.0-SNAPSHOT

Monitoring with JMX

You can monitor Hazelcast members with JMX. When you enable JMX, each member registers MBeans for its distributed data structures and its internal services. Any JMX client, such as JConsole, can read the attributes of these MBeans and call their operations.

Hazelcast also exposes its metrics over JMX. The metrics MBeans do not need the hazelcast.jmx property. The jmx element of the metrics configuration controls them, and it is enabled by default.

Enable JMX​

To monitor a member with JMX, enable the JMX agent of the member's JVM, and then enable JMX in Hazelcast.

Start the JVM with the following system properties to enable the JMX agent:

System propertyEffect
-Dcom.sun.management.jmxremoteEnables the JMX agent
-Dcom.sun.management.jmxremote.port=<port>Optional. Accepts remote connections on the given port.
-Dcom.sun.management.jmxremote.authenticate=falseOptional. Turns off password authentication of JMX connections.

Then set the hazelcast.jmx property to true. The default is false.

xml
<hazelcast>
...
<properties>
<property name="hazelcast.jmx">true</property>
</properties>
...
</hazelcast>

MBean names​

Each Hazelcast MBean has an object name in the com.hazelcast domain. The object name has the following keys:

KeyValue
instanceThe name of the Hazelcast instance
typeThe type of the MBean, such as IMap or HazelcastInstance.Node
nameThe name of the data structure or service

For example, the following object name identifies the MBean of the map trial on the instance _hzInstance_1_dev:

java
ObjectName mapMBeanName = new ObjectName("com.hazelcast:instance=_hzInstance_1_dev,type=IMap,name=trial");

If a value contains any of the characters :, ", ,, =, *, or ?, or a line break, Hazelcast quotes it with ObjectName.quote(). For example, the MBean of a map named orders:eu has the object name com.hazelcast:instance=_hzInstance_1_dev,type=IMap,name="orders:eu".

Connect to the JMX agent​

To connect to a member, use a JMX client such as JConsole or VisualVM with the VisualVM-MBeans plugin. You can also connect from your own Java code.

To connect from Java code, first create a JMXServiceURL with the host of the member and the port that you set in com.sun.management.jmxremote.port:

java
int port = 1099;
String hostname = InetAddress.getLocalHost().getHostName();
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi://" + hostname + ":" + port + "/jndi/rmi://" + hostname + ":" + port + "/jmxrmi");

Then connect to the URL, and get an MBeanServerConnection from the connection:

java
JMXConnector jmxc = JMXConnectorFactory.connect(url, null);
MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();

Use the MBeanServerConnection to read attributes and call operations. The following example reads the name of a map and the number of its entries that the member owns:

java
ObjectName mapMBeanName = new ObjectName("com.hazelcast:instance=_hzInstance_1_dev,type=IMap,name=trial");
System.out.println("Total entries on map " + mbsc.getAttribute(mapMBeanName, "name") + " : "
+ mbsc.getAttribute(mapMBeanName, "localOwnedEntryCount"));

MBeans of a member​

The following sections list the MBeans that a member registers. Each section lists the attributes and operations of one MBean. Operation names end with parentheses. Attributes whose names start with local describe only the member that you connect to, not the whole cluster. For the metrics behind many of these attributes, see List of Hazelcast metrics.

Instance (HazelcastInstance)​

The HazelcastInstance MBean describes the member and its cluster. It has the following attributes and operations:

Attribute or operationDescription
nameName of the instance
versionHazelcast version
buildHazelcast build
configConfiguration of the member, as a string
configSourceSource of the configuration
clusterNameName of the cluster
portNetwork port
clusterTimeCluster-wide time
memberCountNumber of members in the cluster
MembersList of members
runningWhether the member is running
shutdown()Shuts down the member

Node (HazelcastInstance.Node)​

The HazelcastInstance.Node MBean has the following attributes:

AttributeDescription
addressAddress of the member
masterAddressAddress of the master member of the cluster

Partition service (HazelcastInstance.PartitionServiceMBean)​

The HazelcastInstance.PartitionServiceMBean MBean has the following attributes:

AttributeDescription
partitionCountNumber of partitions
activePartitionCountNumber of active partitions
isClusterSafeWhether the cluster is in a safe state
isLocalMemberSafeWhether the member is safe to shut down

Logging service (HazelcastInstance.LoggingService)​

The HazelcastInstance.LoggingService MBean has the following attribute and operations:

Attribute or operationDescription
levelLog level that is set on the member
setLevel(level)Sets the log level of the member
resetLevel()Resets the log level of the member

License (HazelcastInstance.LicenseInfo) Enterprise EditionThis feature requires Hazelcast Enterprise, a licensed edition of the Hazelcast Platform.​

The HazelcastInstance.LicenseInfo MBean holds the details of the member's license. For its attributes, see Get license details with JMX API.

Internal executors (HazelcastInstance.ManagedExecutorService)​

A member registers one HazelcastInstance.ManagedExecutorService MBean for each of the following internal executors. The name key of the object name is the name of the executor:

  • hz:system
  • hz:async
  • hz:scheduled
  • hz:client
  • hz:client-query
  • hz:client-blocking-tasks
  • hz:query
  • hz:io
  • hz:offloadable
  • hz:vector-query Enterprise EditionThis feature requires Hazelcast Enterprise, a licensed edition of the Hazelcast Platform., if vector collections are enabled

Each executor MBean has the following attributes:

AttributeDescription
nameName of the executor
queueSizeNumber of tasks in the work queue
poolSizeNumber of threads in the pool
maximumPoolSizeMaximum number of threads in the pool
remainingQueueCapacityRemaining capacity of the work queue
isShutdownWhether the executor is shut down
isTerminatedWhether the executor is terminated
completedTaskCountNumber of tasks that the executor has completed

WAN publisher (WanPublisher) Enterprise EditionThis feature requires Hazelcast Enterprise, a licensed edition of the Hazelcast Platform.​

A member registers one WanPublisher MBean for each WAN replication publisher. The name key of the object name is the name of the WAN replication and the ID of the publisher, separated by a period. The MBean has the following attribute:

AttributeDescription
stateState of the publisher: REPLICATING, PAUSED, or STOPPED

Map (IMap)​

A member registers an IMap MBean for each map. It has the following attributes and operations:

Attribute or operationDescription
nameName of the map
sizeNumber of entries in the map
configConfiguration of the map
localOwnedEntryCountNumber of entries that the member owns
localOwnedEntryMemoryCostMemory cost of the owned entries, in bytes
localBackupEntryCountNumber of backup entries that the member holds
localBackupEntryMemoryCostMemory cost of the backup entries, in bytes
localBackupCountNumber of backups of each entry
localCreationTimeTime the map was created on the member
localLastAccessTimeTime an owned entry was last read
localLastUpdateTimeTime an owned entry was last updated
localHitsNumber of reads of owned entries
localLockedEntryCountNumber of owned keys that are locked
localDirtyEntryCountNumber of owned entries that are updated but not yet written to the map store
localPutOperationCountNumber of put operations
localSetOperationCountNumber of set operations
localGetOperationCountNumber of get operations
localRemoveOperationCountNumber of remove operations
localValuesOperationCountNumber of values() calls
localEntrySetOperationCountNumber of entrySet() calls
localTotalPutLatencyTotal latency of put operations
localTotalSetLatencyTotal latency of set operations
localTotalGetLatencyTotal latency of get operations
localTotalRemoveLatencyTotal latency of remove operations
localMaxPutLatencyMaximum latency of a put operation
localMaxSetLatencyMaximum latency of a set operation
localMaxGetLatencyMaximum latency of a get operation
localMaxRemoveLatencyMaximum latency of a remove operation
localEventOperationCountNumber of events received
localOtherOperationCountNumber of other operations
localTotalTotal number of operations
localHeapCostHeap cost of the map, including its Near Cache
clear()Removes all entries from the map

To get the average latency of an operation type, divide its total latency by its operation count.

MultiMap (MultiMap)​

A member registers a MultiMap MBean for each MultiMap. It has the following attributes and operations:

Attribute or operationDescription
nameName of the MultiMap
sizeNumber of entries in the MultiMap
configConfiguration of the MultiMap
localOwnedEntryCountNumber of entries that the member owns
localOwnedEntryMemoryCostMemory cost of the owned entries, in bytes
localBackupEntryCountNumber of backup entries that the member holds
localBackupEntryMemoryCostMemory cost of the backup entries, in bytes
localBackupCountNumber of backups of each entry
localCreationTimeTime the MultiMap was created on the member
localLastAccessTimeTime an owned entry was last read
localLastUpdateTimeTime an owned entry was last updated
localHitsNumber of reads of owned entries
localLockedEntryCountNumber of owned keys that are locked
localDirtyEntryCountNumber of owned entries that are dirty
localPutOperationCountNumber of put operations
localGetOperationCountNumber of get operations
localRemoveOperationCountNumber of remove operations
localTotalPutLatencyTotal latency of put operations
localTotalGetLatencyTotal latency of get operations
localTotalRemoveLatencyTotal latency of remove operations
localMaxPutLatencyMaximum latency of a put operation
localMaxGetLatencyMaximum latency of a get operation
localMaxRemoveLatencyMaximum latency of a remove operation
localEventOperationCountNumber of events received
localOtherOperationCountNumber of other operations
localTotalTotal number of operations
clear()Removes all entries from the MultiMap

Replicated map (ReplicatedMap)​

A member registers a ReplicatedMap MBean for each replicated map. It has the following attributes and operations:

Attribute or operationDescription
nameName of the replicated map
sizeNumber of entries in the replicated map
configConfiguration of the replicated map
localOwnedEntryCountNumber of entries that the member owns
localCreationTimeTime the replicated map was created on the member
localLastAccessTimeTime an owned entry was last read
localLastUpdateTimeTime an owned entry was last updated
localHitsNumber of reads of owned entries
localPutOperationCountNumber of put operations
localGetOperationCountNumber of get operations
localRemoveOperationCountNumber of remove operations
localValuesOperationCountNumber of values() calls
localEntrySetOperationCountNumber of entrySet() calls
localTotalPutLatencyTotal latency of put operations
localTotalGetLatencyTotal latency of get operations
localTotalRemoveLatencyTotal latency of remove operations
localMaxPutLatencyMaximum latency of a put operation
localMaxGetLatencyMaximum latency of a get operation
localMaxRemoveLatencyMaximum latency of a remove operation
localEventOperationCountNumber of events received
localOtherOperationCountNumber of other operations
localTotalTotal number of operations
clear()Removes all entries from the replicated map

Queue (IQueue)​

A member registers an IQueue MBean for each queue. It has the following attributes and operations:

Attribute or operationDescription
nameName of the queue
configConfiguration of the queue
partitionKeyPartition key of the queue
localOwnedItemCountNumber of items that the member owns
localBackupItemCountNumber of backup items that the member holds
localMinAgeMinimum age of the items
localMaxAgeMaximum age of the items
localAverageAgeAverage age of the items
localOfferOperationCountNumber of offer, put, and add operations
localRejectedOfferOperationCountNumber of rejected offers
localPollOperationCountNumber of poll, take, and remove operations
localEmptyPollOperationCountNumber of poll operations that returned null
localOtherOperationsCountNumber of other operations
localEventOperationCountNumber of event operations
clear()Removes all items from the queue

List (IList)​

A member registers an IList MBean for each list. It has the following attribute and operation:

Attribute or operationDescription
nameName of the list
clear()Removes all items from the list

Set (ISet)​

A member registers an ISet MBean for each set. It has the following attributes and operation:

Attribute or operationDescription
nameName of the set
partitionKeyPartition key of the set
clear()Removes all items from the set

Topic (ITopic)​

A member registers an ITopic MBean for each topic. It has the following attributes:

AttributeDescription
nameName of the topic
configConfiguration of the topic
localCreationTimeTime the topic was created on the member
localPublishOperationCountNumber of messages published on the member
localReceiveOperationCountNumber of messages received on the member

Reliable topic (ReliableTopic)​

A member registers a ReliableTopic MBean for each reliable topic. It has the following attributes:

AttributeDescription
nameName of the reliable topic
configConfiguration of the reliable topic
localCreationTimeTime the reliable topic was created on the member
localPublishOperationCountNumber of messages published on the member
localReceiveOperationCountNumber of messages received on the member

Executor service (IExecutorService)​

A member registers an IExecutorService MBean for each executor service. It has the following attributes:

AttributeDescription
nameName of the executor service
localCreationTimeTime the executor service was created on the member
localPendingTaskCountNumber of pending tasks
localStartedTaskCountNumber of started tasks
localCompletedTaskCountNumber of completed tasks
localCancelledTaskCountNumber of cancelled tasks
localTotalStartLatencyTotal start latency of the started tasks
localTotalExecutionLatencyTotal execution time of the completed tasks