IGNITE-49 Changed Interface ClusterNodeMetric, removed resetMetric method from Cache interface.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e2a599ec Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e2a599ec Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e2a599ec Branch: refs/heads/ignite-49 Commit: e2a599ec669982bda39169086dcfe024d83dcee7 Parents: 0dd7e5d Author: nikolay_tikhonov <ntikho...@gridgain.com> Authored: Thu Jan 22 15:56:05 2015 +0300 Committer: nikolay_tikhonov <ntikho...@gridgain.com> Committed: Thu Jan 22 15:56:05 2015 +0300 ---------------------------------------------------------------------- .../apache/ignite/cluster/ClusterMetrics.java | 2 +- .../org/apache/ignite/cluster/ClusterNode.java | 4 +- .../ignite/cluster/ClusterNodeMetrics.java | 695 ------------------ .../ignite/cluster/ClusterNodeMetricsMBean.java | 696 +++++++++++++++++++ .../spi/discovery/DiscoveryMetricsHelper.java | 4 +- .../spi/discovery/DiscoveryMetricsProvider.java | 2 +- .../discovery/DiscoveryNodeMetricsAdapter.java | 2 +- .../discovery/tcp/TcpClientDiscoverySpi.java | 4 +- .../spi/discovery/tcp/TcpDiscoverySpi.java | 10 +- .../tcp/internal/TcpDiscoveryNode.java | 6 +- .../messages/TcpDiscoveryHeartbeatMessage.java | 20 +- .../adaptive/AdaptiveCpuLoadProbe.java | 2 +- .../adaptive/AdaptiveJobCountLoadProbe.java | 2 +- .../AdaptiveProcessingTimeLoadProbe.java | 2 +- .../gridgain/grid/cache/CacheMetricsMxBean.java | 95 ++- .../java/org/gridgain/grid/cache/GridCache.java | 5 - .../grid/kernal/ClusterLocalNodeMetrics.java | 311 --------- .../grid/kernal/ClusterMetricsImpl.java | 2 +- .../grid/kernal/ClusterNodeMetricsMBean.java | 29 - .../org/gridgain/grid/kernal/GridKernal.java | 4 +- .../discovery/GridDiscoveryManager.java | 2 +- .../cache/CacheMetricsMxBeanImpl.java | 405 +++++++++++ .../processors/cache/GridCacheAdapter.java | 299 +++----- .../cache/GridCacheMetricsAdapter.java | 426 ------------ .../processors/cache/GridCacheProxyImpl.java | 12 - .../cache/distributed/dht/GridDhtCache.java | 12 +- .../dht/atomic/GridDhtAtomicCache.java | 42 +- .../distributed/near/GridNearCacheAdapter.java | 7 - .../local/atomic/GridLocalAtomicCache.java | 18 +- .../cache/transactions/IgniteTxManager.java | 4 +- .../top/GridTopologyCommandHandler.java | 2 +- .../visor/cache/VisorCacheResetMetricsTask.java | 2 +- .../grid/kernal/visor/node/VisorNodeGcTask.java | 2 +- .../java/org/gridgain/grid/util/GridUtils.java | 2 +- .../GridDiscoveryMetricsHelperSelfTest.java | 10 +- .../grid/kernal/ClusterNodeMetricsSelfTest.java | 6 +- .../grid/kernal/GridDiscoverySelfTest.java | 2 +- .../kernal/GridNonHistoryMetricsSelfTest.java | 4 +- .../cache/GridCacheAbstractMetricsSelfTest.java | 2 +- ...cheTransactionalAbstractMetricsSelfTest.java | 8 +- ...ePartitionedNearDisabledMetricsSelfTest.java | 2 +- .../near/GridCacheNearMetricsSelfTest.java | 2 +- .../grid/p2p/GridP2PClassLoadingSelfTest.java | 2 +- .../gridgain/testframework/GridTestNode.java | 8 +- .../junits/spi/GridSpiAbstractTest.java | 2 +- 45 files changed, 1384 insertions(+), 1796 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java index 48a07f8..e2d4d90 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java +++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java @@ -28,7 +28,7 @@ import java.io.*; * Note that these metrics already represent the current snapshot and can change from call * to call. If projection is dynamic the metrics snapshot will also change with changes * in participating nodes. - * @see ClusterNodeMetrics + * @see ClusterNodeMetricsMBean * @see ClusterGroup#metrics() */ public interface ClusterMetrics extends Serializable { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java index 2b28069..b74c89f 100644 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java +++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNode.java @@ -146,7 +146,7 @@ public interface ClusterNode extends GridMetadataAware { /** * Gets metrics snapshot for this node. Note that node metrics are constantly updated * and provide up to date information about nodes. For example, you can get - * an idea about CPU load on remote node via {@link ClusterNodeMetrics#getCurrentCpuLoad()} + * an idea about CPU load on remote node via {@link ClusterNodeMetricsMBean#getCurrentCpuLoad()} * method and use it during {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} or during collision * resolution. * <p> @@ -156,7 +156,7 @@ public interface ClusterNode extends GridMetadataAware { * * @return Runtime metrics snapshot for this node. */ - public ClusterNodeMetrics metrics(); + public ClusterNodeMetricsMBean metrics(); /** * Gets all node attributes. Attributes are assigned to nodes at startup http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeMetrics.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeMetrics.java deleted file mode 100644 index c818b3d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeMetrics.java +++ /dev/null @@ -1,695 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.cluster; - -import org.apache.ignite.mbean.*; - -import java.io.*; - -/** - * This class represents runtime information on a node. Apart from obvious - * statistical value, this information is used for implementation of - * load balancing, failover, and collision SPIs. For example, collision SPI - * in combination with fail-over SPI could check if other nodes don't have - * any active or waiting jobs and fail-over some jobs to those nodes. - * <p> - * Node metrics for any node can be accessed via {@link org.apache.ignite.cluster.ClusterNode#metrics()} - * method. Keep in mind that there will be a certain network delay (usually - * equal to heartbeat delay) for the accuracy of node metrics. However, when accessing - * metrics on local node {@link org.apache.ignite.IgniteCluster#localNode() Grid.localNode().getMetrics()} - * the metrics are always accurate and up to date. - * <p> - * Local node metrics are registered as {@code MBean} and can be accessed from - * any JMX management console. The simplest way is to use standard {@code jconsole} - * that comes with JDK as it also provides ability to view any node parameter - * as a graph. - * @see org.apache.ignite.cluster.ClusterMetrics - */ -public interface ClusterNodeMetrics extends Serializable { - /** - * Gets last update time of this node metrics. - * - * @return Last update time. - */ - @IgniteMBeanDescription("Last update time of this node metrics.") - public long getLastUpdateTime(); - - /** - * Gets maximum number of jobs that ever ran concurrently on this node. - * Note that this different from {@link #getTotalExecutedJobs()} - * metric and only reflects maximum number of jobs that ran at the same time. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Maximum number of jobs that ever ran concurrently on this node. - */ - @IgniteMBeanDescription("Maximum number of jobs that ever ran concurrently on this node.") - public int getMaximumActiveJobs(); - - /** - * Gets number of currently active jobs concurrently executing on the node. - * - * @return Number of currently active jobs concurrently executing on the node. - */ - @IgniteMBeanDescription("Number of currently active jobs concurrently executing on the node.") - public int getCurrentActiveJobs(); - - /** - * Gets average number of active jobs concurrently executing on the node. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Average number of active jobs. - */ - @IgniteMBeanDescription("Average number of active jobs concurrently executing on the node.") - public float getAverageActiveJobs(); - - /** - * Gets maximum number of waiting jobs this node had. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Maximum number of waiting jobs. - */ - @IgniteMBeanDescription("Maximum number of waiting jobs this node had.") - public int getMaximumWaitingJobs(); - - /** - * Gets number of queued jobs currently waiting to be executed. - * - * @return Number of queued jobs currently waiting to be executed. - */ - @IgniteMBeanDescription("Number of queued jobs currently waiting to be executed.") - public int getCurrentWaitingJobs(); - - /** - * Gets average number of waiting jobs this node had queued. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Average number of waiting jobs. - */ - @IgniteMBeanDescription("Average number of waiting jobs this node had queued.") - public float getAverageWaitingJobs(); - - /** - * Gets maximum number of jobs rejected at once during a single collision resolution - * operation. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Maximum number of jobs rejected at once. - */ - @IgniteMBeanDescription("Maximum number of jobs rejected at once during a single collision resolution operation.") - public int getMaximumRejectedJobs(); - - /** - * Gets number of jobs rejected after more recent collision resolution operation. - * - * @return Number of jobs rejected after more recent collision resolution operation. - */ - @IgniteMBeanDescription("Number of jobs rejected after more recent collision resolution operation.") - public int getCurrentRejectedJobs(); - - /** - * Gets average number of jobs this node rejects during collision resolution operations. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of grid configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Average number of jobs this node rejects during collision resolution operations. - */ - @IgniteMBeanDescription("Average number of jobs this node rejects during collision resolution operations.") - public float getAverageRejectedJobs(); - - /** - * Gets total number of jobs this node rejects during collision resolution operations since node startup. - * <p> - * <b>Note:</b> Unlike most of other aggregation metrics this metric is not calculated over history - * but over the entire node life. - * - * @return Total number of jobs this node rejects during collision resolution - * operations since node startup. - */ - @IgniteMBeanDescription( - "Total number of jobs this node rejects during collision resolution operations since node startup.") - public int getTotalRejectedJobs(); - - /** - * Gets maximum number of cancelled jobs this node ever had running - * concurrently. - * - * @return Maximum number of cancelled jobs. - */ - @IgniteMBeanDescription("Maximum number of cancelled jobs this node ever had running concurrently.") - public int getMaximumCancelledJobs(); - - /** - * Gets number of cancelled jobs that are still running. Just like - * regular java threads, jobs will receive cancel notification, but - * it's ultimately up to the job itself to gracefully exit. - * - * @return Number of cancelled jobs that are still running. - */ - @IgniteMBeanDescription("Number of cancelled jobs that are still running.") - public int getCurrentCancelledJobs(); - - /** - * Gets average number of cancelled jobs this node ever had running - * concurrently. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Average number of cancelled jobs. - */ - @IgniteMBeanDescription("Average number of cancelled jobs this node ever had running concurrently.") - public float getAverageCancelledJobs(); - - /** - * Gets number of cancelled jobs since node startup. - * <p> - * <b>Note:</b> Unlike most of other aggregation metrics this metric is not calculated over history - * but over the entire node life. - * - * @return Total number of cancelled jobs since node startup. - */ - @IgniteMBeanDescription("Total number of cancelled jobs since node startup.") - public int getTotalCancelledJobs(); - - /** - * Gets total number of jobs handled by the node since node startup. - * <p> - * <b>Note:</b> Unlike most of other aggregation metrics this metric is not calculated over history - * but over the entire node life. - * - * @return Total number of jobs handled by the node since node startup. - */ - @IgniteMBeanDescription("Total number of jobs handled by the node.") - public int getTotalExecutedJobs(); - - /** - * Gets maximum time a job ever spent waiting in a queue to be executed. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Maximum waiting time. - */ - @IgniteMBeanDescription("Maximum time a job ever spent waiting in a queue to be executed.") - public long getMaximumJobWaitTime(); - - /** - * Gets current time an oldest jobs has spent waiting to be executed. - * - * @return Current wait time of oldest job. - */ - @IgniteMBeanDescription("Current wait time of oldest job.") - public long getCurrentJobWaitTime(); - - /** - * Gets average time jobs spend waiting in the queue to be executed. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Average job wait time. - */ - @IgniteMBeanDescription("Average time jobs spend waiting in the queue to be executed.") - public double getAverageJobWaitTime(); - - /** - * Gets time it took to execute the longest job on the node. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Time it took to execute the longest job on the node. - */ - @IgniteMBeanDescription("Time it took to execute the longest job on the node.") - public long getMaximumJobExecuteTime(); - - /** - * Gets longest time a current job has been executing for. - * - * @return Longest time a current job has been executing for. - */ - @IgniteMBeanDescription("Longest time a current job has been executing for.") - public long getCurrentJobExecuteTime(); - - /** - * Gets average time a job takes to execute on the node. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Average job execution time. - */ - @IgniteMBeanDescription("Average time a job takes to execute on the node.") - public double getAverageJobExecuteTime(); - - /** - * Gets total number of tasks handled by the node. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Total number of jobs handled by the node. - */ - @IgniteMBeanDescription("Total number of tasks handled by the node.") - public int getTotalExecutedTasks(); - - /** - * Gets total time this node spent executing jobs. - * - * @return Total time this node spent executing jobs. - */ - @IgniteMBeanDescription("Total time this node spent executing jobs.") - public long getTotalBusyTime(); - - /** - * Gets total time this node spent idling (not executing any jobs). - * - * @return Gets total time this node spent idling. - */ - @IgniteMBeanDescription("Total time this node spent idling (not executing any jobs).") - public long getTotalIdleTime(); - - /** - * Gets time this node spend idling since executing last job. - * - * @return Time this node spend idling since executing last job. - */ - @IgniteMBeanDescription("Time this node spend idling since executing last job.") - public long getCurrentIdleTime(); - - /** - * Gets percentage of time this node is busy executing jobs vs. idling. - * - * @return Percentage of time this node is busy (value is less than - * or equal to {@code 1} and greater than or equal to {@code 0}) - */ - @IgniteMBeanDescription("Percentage of time this node is busy executing jobs vs. idling.") - public float getBusyTimePercentage(); - - /** - * Gets percentage of time this node is idling vs. executing jobs. - * - * @return Percentage of time this node is idle (value is less than - * or equal to {@code 1} and greater than or equal to {@code 0}) - */ - @IgniteMBeanDescription("Percentage of time this node is idling vs. executing jobs.") - public float getIdleTimePercentage(); - - /** - * Returns the number of CPUs available to the Java Virtual Machine. - * This method is equivalent to the {@link Runtime#availableProcessors()} - * method. - * <p> - * Note that this value may change during successive invocations of the - * virtual machine. - * - * @return The number of processors available to the virtual - * machine, never smaller than one. - */ - @IgniteMBeanDescription("The number of CPUs available to the Java Virtual Machine.") - public int getTotalCpus(); - - /** - * Returns the CPU usage usage in {@code [0, 1]} range. - * The exact way how this number is calculated depends on SPI implementation. - * <p> - * If the CPU usage is not available, a negative value is returned. - * <p> - * This method is designed to provide a hint about the system load - * and may be queried frequently. The load average may be unavailable on - * some platform where it is expensive to implement this method. - * - * @return The estimated CPU usage in {@code [0, 1]} range. - * Negative value if not available. - */ - @IgniteMBeanDescription("The system load average; or a negative value if not available.") - public double getCurrentCpuLoad(); - - /** - * Gets average of CPU load values over all metrics kept in the history. - * <p> - * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are - * calculated over all the metrics kept in history. The - * history size is set via either one or both of configuration settings: - * <ul> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> - * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> - * </ul> - * - * @return Average of CPU load value in {@code [0, 1]} range over all metrics kept - * in the history. - */ - @IgniteMBeanDescription("Average of CPU load values over all metrics kept in the history.") - public double getAverageCpuLoad(); - - /** - * Returns average time spent in CG since the last update. - * - * @return Average time spent in CG since the last update. - */ - @IgniteMBeanDescription("Average time spent in CG since the last update.") - public double getCurrentGcCpuLoad(); - - /** - * Returns the amount of heap memory in bytes that the JVM - * initially requests from the operating system for memory management. - * This method returns {@code -1} if the initial memory size is undefined. - * <p> - * This value represents a setting of the heap memory for Java VM and is - * not a sum of all initial heap values for all memory pools. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The initial size of memory in bytes; {@code -1} if undefined. - */ - @IgniteMBeanDescription("The initial size of memory in bytes; -1 if undefined.") - public long getHeapMemoryInitialized(); - - /** - * Returns the current heap size that is used for object allocation. - * The heap consists of one or more memory pools. This value is - * the sum of {@code used} heap memory values of all heap memory pools. - * <p> - * The amount of used memory in the returned is the amount of memory - * occupied by both live objects and garbage objects that have not - * been collected, if any. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return Amount of heap memory used. - */ - @IgniteMBeanDescription("Current heap size that is used for object allocation.") - public long getHeapMemoryUsed(); - - /** - * Returns the amount of heap memory in bytes that is committed for - * the JVM to use. This amount of memory is - * guaranteed for the JVM to use. - * The heap consists of one or more memory pools. This value is - * the sum of {@code committed} heap memory values of all heap memory pools. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The amount of committed memory in bytes. - */ - @IgniteMBeanDescription("The amount of committed memory in bytes.") - public long getHeapMemoryCommitted(); - - /** - * Returns the maximum amount of heap memory in bytes that can be - * used for memory management. This method returns {@code -1} - * if the maximum memory size is undefined. - * <p> - * This amount of memory is not guaranteed to be available - * for memory management if it is greater than the amount of - * committed memory. The JVM may fail to allocate - * memory even if the amount of used memory does not exceed this - * maximum size. - * <p> - * This value represents a setting of the heap memory for Java VM and is - * not a sum of all initial heap values for all memory pools. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The maximum amount of memory in bytes; {@code -1} if undefined. - */ - @IgniteMBeanDescription("The maximum amount of memory in bytes; -1 if undefined.") - public long getHeapMemoryMaximum(); - - /** - * Returns the amount of non-heap memory in bytes that the JVM - * initially requests from the operating system for memory management. - * This method returns {@code -1} if the initial memory size is undefined. - * <p> - * This value represents a setting of non-heap memory for Java VM and is - * not a sum of all initial heap values for all memory pools. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The initial size of memory in bytes; {@code -1} if undefined. - */ - @IgniteMBeanDescription("The initial size of memory in bytes; -1 if undefined.") - public long getNonHeapMemoryInitialized(); - - /** - * Returns the current non-heap memory size that is used by Java VM. - * The non-heap memory consists of one or more memory pools. This value is - * the sum of {@code used} non-heap memory values of all non-heap memory pools. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return Amount of none-heap memory used. - */ - @IgniteMBeanDescription("Current non-heap memory size that is used by Java VM.") - public long getNonHeapMemoryUsed(); - - /** - * Returns the amount of non-heap memory in bytes that is committed for - * the JVM to use. This amount of memory is - * guaranteed for the JVM to use. - * The non-heap memory consists of one or more memory pools. This value is - * the sum of {@code committed} non-heap memory values of all non-heap memory pools. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The amount of committed memory in bytes. - */ - @IgniteMBeanDescription("Amount of non-heap memory in bytes that is committed for the JVM to use.") - public long getNonHeapMemoryCommitted(); - - /** - * Returns the maximum amount of non-heap memory in bytes that can be - * used for memory management. This method returns {@code -1} - * if the maximum memory size is undefined. - * <p> - * This amount of memory is not guaranteed to be available - * for memory management if it is greater than the amount of - * committed memory. The JVM may fail to allocate - * memory even if the amount of used memory does not exceed this - * maximum size. - * <p> - * This value represents a setting of the non-heap memory for Java VM and is - * not a sum of all initial non-heap values for all memory pools. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The maximum amount of memory in bytes; {@code -1} if undefined. - */ - @IgniteMBeanDescription("Maximum amount of non-heap memory in bytes that can " + - "be used for memory management. -1 if undefined.") - public long getNonHeapMemoryMaximum(); - - /** - * Returns the uptime of the JVM in milliseconds. - * - * @return Uptime of the JVM in milliseconds. - */ - @IgniteMBeanDescription("Uptime of the JVM in milliseconds.") - public long getUpTime(); - - /** - * Returns the start time of the JVM in milliseconds. - * This method returns the approximate time when the Java virtual - * machine started. - * - * @return Start time of the JVM in milliseconds. - */ - @IgniteMBeanDescription("Start time of the JVM in milliseconds.") - public long getStartTime(); - - /** - * Returns the start time of grid node in milliseconds. - * There can be several grid nodes started in one JVM, so JVM start time will be - * the same for all of them, but node start time will be different. - * - * @return Start time of the grid node in milliseconds. - */ - public long getNodeStartTime(); - - /** - * Returns the current number of live threads including both - * daemon and non-daemon threads. - * - * @return Current number of live threads. - */ - @IgniteMBeanDescription("Current number of live threads.") - public int getCurrentThreadCount(); - - /** - * Returns the maximum live thread count since the JVM - * started or peak was reset. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The peak live thread count. - */ - @IgniteMBeanDescription("The peak live thread count.") - public int getMaximumThreadCount(); - - /** - * Returns the total number of threads created and also started - * since the JVM started. - * <p> - * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated - * from the time of the node's startup. - * - * @return The total number of threads started. - */ - @IgniteMBeanDescription("The total number of threads started.") - public long getTotalStartedThreadCount(); - - /** - * Returns the current number of live daemon threads. - * - * @return Current number of live daemon threads. - */ - @IgniteMBeanDescription("Current number of live daemon threads.") - public int getCurrentDaemonThreadCount(); - - /** - * In-Memory Data Grid assigns incremental versions to all cache operations. This method provides - * the latest data version on the node. - * - * @return Last data version. - */ - @IgniteMBeanDescription("Last data version.") - public long getLastDataVersion(); - - /** - * Gets sent messages count. - * - * @return Sent messages count. - */ - @IgniteMBeanDescription("Sent messages count.") - public int getSentMessagesCount(); - - /** - * Gets sent bytes count. - * - * @return Sent bytes count. - */ - @IgniteMBeanDescription("Sent bytes count.") - public long getSentBytesCount(); - - /** - * Gets received messages count. - * - * @return Received messages count. - */ - @IgniteMBeanDescription("Received messages count.") - public int getReceivedMessagesCount(); - - /** - * Gets received bytes count. - * - * @return Received bytes count. - */ - @IgniteMBeanDescription("Received bytes count.") - public long getReceivedBytesCount(); - - /** - * Gets outbound messages queue size. - * - * @return Outbound messages queue size. - */ - @IgniteMBeanDescription("Outbound messages queue size.") - public int getOutboundMessagesQueueSize(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeMetricsMBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeMetricsMBean.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeMetricsMBean.java new file mode 100644 index 0000000..c9a5397 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterNodeMetricsMBean.java @@ -0,0 +1,696 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.cluster; + +import org.apache.ignite.mbean.*; + +import java.io.*; + +/** + * This class represents runtime information on a node. Apart from obvious + * statistical value, this information is used for implementation of + * load balancing, failover, and collision SPIs. For example, collision SPI + * in combination with fail-over SPI could check if other nodes don't have + * any active or waiting jobs and fail-over some jobs to those nodes. + * <p> + * Node metrics for any node can be accessed via {@link org.apache.ignite.cluster.ClusterNode#metrics()} + * method. Keep in mind that there will be a certain network delay (usually + * equal to heartbeat delay) for the accuracy of node metrics. However, when accessing + * metrics on local node {@link org.apache.ignite.IgniteCluster#localNode() Grid.localNode().getMetrics()} + * the metrics are always accurate and up to date. + * <p> + * Local node metrics are registered as {@code MBean} and can be accessed from + * any JMX management console. The simplest way is to use standard {@code jconsole} + * that comes with JDK as it also provides ability to view any node parameter + * as a graph. + * @see org.apache.ignite.cluster.ClusterMetrics + */ +@IgniteMBeanDescription("MBean that provides access to all local node metrics.") +public interface ClusterNodeMetricsMBean extends Serializable { + /** + * Gets last update time of this node metrics. + * + * @return Last update time. + */ + @IgniteMBeanDescription("Last update time of this node metrics.") + public long getLastUpdateTime(); + + /** + * Gets maximum number of jobs that ever ran concurrently on this node. + * Note that this different from {@link #getTotalExecutedJobs()} + * metric and only reflects maximum number of jobs that ran at the same time. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Maximum number of jobs that ever ran concurrently on this node. + */ + @IgniteMBeanDescription("Maximum number of jobs that ever ran concurrently on this node.") + public int getMaximumActiveJobs(); + + /** + * Gets number of currently active jobs concurrently executing on the node. + * + * @return Number of currently active jobs concurrently executing on the node. + */ + @IgniteMBeanDescription("Number of currently active jobs concurrently executing on the node.") + public int getCurrentActiveJobs(); + + /** + * Gets average number of active jobs concurrently executing on the node. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Average number of active jobs. + */ + @IgniteMBeanDescription("Average number of active jobs concurrently executing on the node.") + public float getAverageActiveJobs(); + + /** + * Gets maximum number of waiting jobs this node had. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Maximum number of waiting jobs. + */ + @IgniteMBeanDescription("Maximum number of waiting jobs this node had.") + public int getMaximumWaitingJobs(); + + /** + * Gets number of queued jobs currently waiting to be executed. + * + * @return Number of queued jobs currently waiting to be executed. + */ + @IgniteMBeanDescription("Number of queued jobs currently waiting to be executed.") + public int getCurrentWaitingJobs(); + + /** + * Gets average number of waiting jobs this node had queued. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Average number of waiting jobs. + */ + @IgniteMBeanDescription("Average number of waiting jobs this node had queued.") + public float getAverageWaitingJobs(); + + /** + * Gets maximum number of jobs rejected at once during a single collision resolution + * operation. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Maximum number of jobs rejected at once. + */ + @IgniteMBeanDescription("Maximum number of jobs rejected at once during a single collision resolution operation.") + public int getMaximumRejectedJobs(); + + /** + * Gets number of jobs rejected after more recent collision resolution operation. + * + * @return Number of jobs rejected after more recent collision resolution operation. + */ + @IgniteMBeanDescription("Number of jobs rejected after more recent collision resolution operation.") + public int getCurrentRejectedJobs(); + + /** + * Gets average number of jobs this node rejects during collision resolution operations. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of grid configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Average number of jobs this node rejects during collision resolution operations. + */ + @IgniteMBeanDescription("Average number of jobs this node rejects during collision resolution operations.") + public float getAverageRejectedJobs(); + + /** + * Gets total number of jobs this node rejects during collision resolution operations since node startup. + * <p> + * <b>Note:</b> Unlike most of other aggregation metrics this metric is not calculated over history + * but over the entire node life. + * + * @return Total number of jobs this node rejects during collision resolution + * operations since node startup. + */ + @IgniteMBeanDescription( + "Total number of jobs this node rejects during collision resolution operations since node startup.") + public int getTotalRejectedJobs(); + + /** + * Gets maximum number of cancelled jobs this node ever had running + * concurrently. + * + * @return Maximum number of cancelled jobs. + */ + @IgniteMBeanDescription("Maximum number of cancelled jobs this node ever had running concurrently.") + public int getMaximumCancelledJobs(); + + /** + * Gets number of cancelled jobs that are still running. Just like + * regular java threads, jobs will receive cancel notification, but + * it's ultimately up to the job itself to gracefully exit. + * + * @return Number of cancelled jobs that are still running. + */ + @IgniteMBeanDescription("Number of cancelled jobs that are still running.") + public int getCurrentCancelledJobs(); + + /** + * Gets average number of cancelled jobs this node ever had running + * concurrently. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Average number of cancelled jobs. + */ + @IgniteMBeanDescription("Average number of cancelled jobs this node ever had running concurrently.") + public float getAverageCancelledJobs(); + + /** + * Gets number of cancelled jobs since node startup. + * <p> + * <b>Note:</b> Unlike most of other aggregation metrics this metric is not calculated over history + * but over the entire node life. + * + * @return Total number of cancelled jobs since node startup. + */ + @IgniteMBeanDescription("Total number of cancelled jobs since node startup.") + public int getTotalCancelledJobs(); + + /** + * Gets total number of jobs handled by the node since node startup. + * <p> + * <b>Note:</b> Unlike most of other aggregation metrics this metric is not calculated over history + * but over the entire node life. + * + * @return Total number of jobs handled by the node since node startup. + */ + @IgniteMBeanDescription("Total number of jobs handled by the node.") + public int getTotalExecutedJobs(); + + /** + * Gets maximum time a job ever spent waiting in a queue to be executed. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Maximum waiting time. + */ + @IgniteMBeanDescription("Maximum time a job ever spent waiting in a queue to be executed.") + public long getMaximumJobWaitTime(); + + /** + * Gets current time an oldest jobs has spent waiting to be executed. + * + * @return Current wait time of oldest job. + */ + @IgniteMBeanDescription("Current wait time of oldest job.") + public long getCurrentJobWaitTime(); + + /** + * Gets average time jobs spend waiting in the queue to be executed. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Average job wait time. + */ + @IgniteMBeanDescription("Average time jobs spend waiting in the queue to be executed.") + public double getAverageJobWaitTime(); + + /** + * Gets time it took to execute the longest job on the node. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Time it took to execute the longest job on the node. + */ + @IgniteMBeanDescription("Time it took to execute the longest job on the node.") + public long getMaximumJobExecuteTime(); + + /** + * Gets longest time a current job has been executing for. + * + * @return Longest time a current job has been executing for. + */ + @IgniteMBeanDescription("Longest time a current job has been executing for.") + public long getCurrentJobExecuteTime(); + + /** + * Gets average time a job takes to execute on the node. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Average job execution time. + */ + @IgniteMBeanDescription("Average time a job takes to execute on the node.") + public double getAverageJobExecuteTime(); + + /** + * Gets total number of tasks handled by the node. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Total number of jobs handled by the node. + */ + @IgniteMBeanDescription("Total number of tasks handled by the node.") + public int getTotalExecutedTasks(); + + /** + * Gets total time this node spent executing jobs. + * + * @return Total time this node spent executing jobs. + */ + @IgniteMBeanDescription("Total time this node spent executing jobs.") + public long getTotalBusyTime(); + + /** + * Gets total time this node spent idling (not executing any jobs). + * + * @return Gets total time this node spent idling. + */ + @IgniteMBeanDescription("Total time this node spent idling (not executing any jobs).") + public long getTotalIdleTime(); + + /** + * Gets time this node spend idling since executing last job. + * + * @return Time this node spend idling since executing last job. + */ + @IgniteMBeanDescription("Time this node spend idling since executing last job.") + public long getCurrentIdleTime(); + + /** + * Gets percentage of time this node is busy executing jobs vs. idling. + * + * @return Percentage of time this node is busy (value is less than + * or equal to {@code 1} and greater than or equal to {@code 0}) + */ + @IgniteMBeanDescription("Percentage of time this node is busy executing jobs vs. idling.") + public float getBusyTimePercentage(); + + /** + * Gets percentage of time this node is idling vs. executing jobs. + * + * @return Percentage of time this node is idle (value is less than + * or equal to {@code 1} and greater than or equal to {@code 0}) + */ + @IgniteMBeanDescription("Percentage of time this node is idling vs. executing jobs.") + public float getIdleTimePercentage(); + + /** + * Returns the number of CPUs available to the Java Virtual Machine. + * This method is equivalent to the {@link Runtime#availableProcessors()} + * method. + * <p> + * Note that this value may change during successive invocations of the + * virtual machine. + * + * @return The number of processors available to the virtual + * machine, never smaller than one. + */ + @IgniteMBeanDescription("The number of CPUs available to the Java Virtual Machine.") + public int getTotalCpus(); + + /** + * Returns the CPU usage usage in {@code [0, 1]} range. + * The exact way how this number is calculated depends on SPI implementation. + * <p> + * If the CPU usage is not available, a negative value is returned. + * <p> + * This method is designed to provide a hint about the system load + * and may be queried frequently. The load average may be unavailable on + * some platform where it is expensive to implement this method. + * + * @return The estimated CPU usage in {@code [0, 1]} range. + * Negative value if not available. + */ + @IgniteMBeanDescription("The system load average; or a negative value if not available.") + public double getCurrentCpuLoad(); + + /** + * Gets average of CPU load values over all metrics kept in the history. + * <p> + * <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are + * calculated over all the metrics kept in history. The + * history size is set via either one or both of configuration settings: + * <ul> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsExpireTime()}</li> + * <li>{@link org.apache.ignite.configuration.IgniteConfiguration#getMetricsHistorySize()}</li> + * </ul> + * + * @return Average of CPU load value in {@code [0, 1]} range over all metrics kept + * in the history. + */ + @IgniteMBeanDescription("Average of CPU load values over all metrics kept in the history.") + public double getAverageCpuLoad(); + + /** + * Returns average time spent in CG since the last update. + * + * @return Average time spent in CG since the last update. + */ + @IgniteMBeanDescription("Average time spent in CG since the last update.") + public double getCurrentGcCpuLoad(); + + /** + * Returns the amount of heap memory in bytes that the JVM + * initially requests from the operating system for memory management. + * This method returns {@code -1} if the initial memory size is undefined. + * <p> + * This value represents a setting of the heap memory for Java VM and is + * not a sum of all initial heap values for all memory pools. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The initial size of memory in bytes; {@code -1} if undefined. + */ + @IgniteMBeanDescription("The initial size of memory in bytes; -1 if undefined.") + public long getHeapMemoryInitialized(); + + /** + * Returns the current heap size that is used for object allocation. + * The heap consists of one or more memory pools. This value is + * the sum of {@code used} heap memory values of all heap memory pools. + * <p> + * The amount of used memory in the returned is the amount of memory + * occupied by both live objects and garbage objects that have not + * been collected, if any. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return Amount of heap memory used. + */ + @IgniteMBeanDescription("Current heap size that is used for object allocation.") + public long getHeapMemoryUsed(); + + /** + * Returns the amount of heap memory in bytes that is committed for + * the JVM to use. This amount of memory is + * guaranteed for the JVM to use. + * The heap consists of one or more memory pools. This value is + * the sum of {@code committed} heap memory values of all heap memory pools. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The amount of committed memory in bytes. + */ + @IgniteMBeanDescription("The amount of committed memory in bytes.") + public long getHeapMemoryCommitted(); + + /** + * Returns the maximum amount of heap memory in bytes that can be + * used for memory management. This method returns {@code -1} + * if the maximum memory size is undefined. + * <p> + * This amount of memory is not guaranteed to be available + * for memory management if it is greater than the amount of + * committed memory. The JVM may fail to allocate + * memory even if the amount of used memory does not exceed this + * maximum size. + * <p> + * This value represents a setting of the heap memory for Java VM and is + * not a sum of all initial heap values for all memory pools. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The maximum amount of memory in bytes; {@code -1} if undefined. + */ + @IgniteMBeanDescription("The maximum amount of memory in bytes; -1 if undefined.") + public long getHeapMemoryMaximum(); + + /** + * Returns the amount of non-heap memory in bytes that the JVM + * initially requests from the operating system for memory management. + * This method returns {@code -1} if the initial memory size is undefined. + * <p> + * This value represents a setting of non-heap memory for Java VM and is + * not a sum of all initial heap values for all memory pools. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The initial size of memory in bytes; {@code -1} if undefined. + */ + @IgniteMBeanDescription("The initial size of memory in bytes; -1 if undefined.") + public long getNonHeapMemoryInitialized(); + + /** + * Returns the current non-heap memory size that is used by Java VM. + * The non-heap memory consists of one or more memory pools. This value is + * the sum of {@code used} non-heap memory values of all non-heap memory pools. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return Amount of none-heap memory used. + */ + @IgniteMBeanDescription("Current non-heap memory size that is used by Java VM.") + public long getNonHeapMemoryUsed(); + + /** + * Returns the amount of non-heap memory in bytes that is committed for + * the JVM to use. This amount of memory is + * guaranteed for the JVM to use. + * The non-heap memory consists of one or more memory pools. This value is + * the sum of {@code committed} non-heap memory values of all non-heap memory pools. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The amount of committed memory in bytes. + */ + @IgniteMBeanDescription("Amount of non-heap memory in bytes that is committed for the JVM to use.") + public long getNonHeapMemoryCommitted(); + + /** + * Returns the maximum amount of non-heap memory in bytes that can be + * used for memory management. This method returns {@code -1} + * if the maximum memory size is undefined. + * <p> + * This amount of memory is not guaranteed to be available + * for memory management if it is greater than the amount of + * committed memory. The JVM may fail to allocate + * memory even if the amount of used memory does not exceed this + * maximum size. + * <p> + * This value represents a setting of the non-heap memory for Java VM and is + * not a sum of all initial non-heap values for all memory pools. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The maximum amount of memory in bytes; {@code -1} if undefined. + */ + @IgniteMBeanDescription("Maximum amount of non-heap memory in bytes that can " + + "be used for memory management. -1 if undefined.") + public long getNonHeapMemoryMaximum(); + + /** + * Returns the uptime of the JVM in milliseconds. + * + * @return Uptime of the JVM in milliseconds. + */ + @IgniteMBeanDescription("Uptime of the JVM in milliseconds.") + public long getUpTime(); + + /** + * Returns the start time of the JVM in milliseconds. + * This method returns the approximate time when the Java virtual + * machine started. + * + * @return Start time of the JVM in milliseconds. + */ + @IgniteMBeanDescription("Start time of the JVM in milliseconds.") + public long getStartTime(); + + /** + * Returns the start time of grid node in milliseconds. + * There can be several grid nodes started in one JVM, so JVM start time will be + * the same for all of them, but node start time will be different. + * + * @return Start time of the grid node in milliseconds. + */ + public long getNodeStartTime(); + + /** + * Returns the current number of live threads including both + * daemon and non-daemon threads. + * + * @return Current number of live threads. + */ + @IgniteMBeanDescription("Current number of live threads.") + public int getCurrentThreadCount(); + + /** + * Returns the maximum live thread count since the JVM + * started or peak was reset. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The peak live thread count. + */ + @IgniteMBeanDescription("The peak live thread count.") + public int getMaximumThreadCount(); + + /** + * Returns the total number of threads created and also started + * since the JVM started. + * <p> + * <b>Note:</b> this is <b>not</b> an aggregated metric and it's calculated + * from the time of the node's startup. + * + * @return The total number of threads started. + */ + @IgniteMBeanDescription("The total number of threads started.") + public long getTotalStartedThreadCount(); + + /** + * Returns the current number of live daemon threads. + * + * @return Current number of live daemon threads. + */ + @IgniteMBeanDescription("Current number of live daemon threads.") + public int getCurrentDaemonThreadCount(); + + /** + * In-Memory Data Grid assigns incremental versions to all cache operations. This method provides + * the latest data version on the node. + * + * @return Last data version. + */ + @IgniteMBeanDescription("Last data version.") + public long getLastDataVersion(); + + /** + * Gets sent messages count. + * + * @return Sent messages count. + */ + @IgniteMBeanDescription("Sent messages count.") + public int getSentMessagesCount(); + + /** + * Gets sent bytes count. + * + * @return Sent bytes count. + */ + @IgniteMBeanDescription("Sent bytes count.") + public long getSentBytesCount(); + + /** + * Gets received messages count. + * + * @return Received messages count. + */ + @IgniteMBeanDescription("Received messages count.") + public int getReceivedMessagesCount(); + + /** + * Gets received bytes count. + * + * @return Received bytes count. + */ + @IgniteMBeanDescription("Received bytes count.") + public long getReceivedBytesCount(); + + /** + * Gets outbound messages queue size. + * + * @return Outbound messages queue size. + */ + @IgniteMBeanDescription("Outbound messages queue size.") + public int getOutboundMessagesQueueSize(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java index 288d017..c348203 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsHelper.java @@ -91,7 +91,7 @@ public final class DiscoveryMetricsHelper { * @param metrics Node metrics to serialize. * @return New offset. */ - public static int serialize(byte[] data, int off, ClusterNodeMetrics metrics) { + public static int serialize(byte[] data, int off, ClusterNodeMetricsMBean metrics) { int start = off; off = U.intToBytes(metrics.getMaximumActiveJobs(), data, off); @@ -157,7 +157,7 @@ public final class DiscoveryMetricsHelper { * @param off Offset into byte array. * @return Deserialized node metrics. */ - public static ClusterNodeMetrics deserialize(byte[] data, int off) { + public static ClusterNodeMetricsMBean deserialize(byte[] data, int off) { int start = off; DiscoveryNodeMetricsAdapter metrics = new DiscoveryNodeMetricsAdapter(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsProvider.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsProvider.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsProvider.java index c92a175..c64ebb3 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsProvider.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryMetricsProvider.java @@ -35,5 +35,5 @@ public interface DiscoveryMetricsProvider { * * @return Up to date metrics data about local node. */ - public ClusterNodeMetrics getMetrics(); + public ClusterNodeMetricsMBean getMetrics(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryNodeMetricsAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryNodeMetricsAdapter.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryNodeMetricsAdapter.java index 1679cbe..6101f37 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryNodeMetricsAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/DiscoveryNodeMetricsAdapter.java @@ -29,7 +29,7 @@ import java.io.*; * Note that whenever adding or removing metric parameters, care * must be taken to update {@link DiscoveryMetricsHelper} as well. */ -public class DiscoveryNodeMetricsAdapter implements ClusterNodeMetrics, Externalizable { +public class DiscoveryNodeMetricsAdapter implements ClusterNodeMetricsMBean, Externalizable { /** */ private static final long serialVersionUID = 0L; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java index d9f8e30..9b70208 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpClientDiscoverySpi.java @@ -1095,7 +1095,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp updateMetrics(e.getKey(), metricsSet.metrics(), tstamp); - for (T2<UUID, ClusterNodeMetrics> t : metricsSet.clientMetrics()) + for (T2<UUID, ClusterNodeMetricsMBean> t : metricsSet.clientMetrics()) updateMetrics(t.get1(), t.get2(), tstamp); } } @@ -1146,7 +1146,7 @@ public class TcpClientDiscoverySpi extends TcpDiscoverySpiAdapter implements Tcp * @param metrics Metrics. * @param tstamp Timestamp. */ - private void updateMetrics(UUID nodeId, ClusterNodeMetrics metrics, long tstamp) { + private void updateMetrics(UUID nodeId, ClusterNodeMetricsMBean metrics, long tstamp) { assert nodeId != null; assert metrics != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java index e5573e6..fe1a1e3 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java @@ -4311,7 +4311,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov updateMetrics(e.getKey(), metricsSet.metrics(), tstamp); - for (T2<UUID, ClusterNodeMetrics> t : metricsSet.clientMetrics()) + for (T2<UUID, ClusterNodeMetricsMBean> t : metricsSet.clientMetrics()) updateMetrics(t.get1(), t.get2(), tstamp); } } @@ -4325,7 +4325,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov for (Map.Entry<UUID, ClientMessageWorker> e : clientMsgWorkers.entrySet()) { UUID nodeId = e.getKey(); - ClusterNodeMetrics metrics = e.getValue().metrics(); + ClusterNodeMetricsMBean metrics = e.getValue().metrics(); if (metrics != null) msg.setClientMetrics(locNodeId, nodeId, metrics); @@ -4370,7 +4370,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov * @param metrics Metrics. * @param tstamp Timestamp. */ - private void updateMetrics(UUID nodeId, ClusterNodeMetrics metrics, long tstamp) { + private void updateMetrics(UUID nodeId, ClusterNodeMetricsMBean metrics, long tstamp) { assert nodeId != null; assert metrics != null; @@ -5076,7 +5076,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov private final Socket sock; /** Current client metrics. */ - private volatile ClusterNodeMetrics metrics; + private volatile ClusterNodeMetricsMBean metrics; /** * @param sock Socket. @@ -5092,7 +5092,7 @@ public class TcpDiscoverySpi extends TcpDiscoverySpiAdapter implements TcpDiscov /** * @return Current client metrics. */ - ClusterNodeMetrics metrics() { + ClusterNodeMetricsMBean metrics() { return metrics; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java index 5129f56..77bed43 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/internal/TcpDiscoveryNode.java @@ -72,7 +72,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste /** Node metrics. */ @GridToStringExclude - private volatile ClusterNodeMetrics metrics; + private volatile ClusterNodeMetricsMBean metrics; /** Node order in the topology. */ private volatile long order; @@ -192,7 +192,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste } /** {@inheritDoc} */ - @Override public ClusterNodeMetrics metrics() { + @Override public ClusterNodeMetricsMBean metrics() { if (metricsProvider != null) metrics = metricsProvider.getMetrics(); @@ -204,7 +204,7 @@ public class TcpDiscoveryNode extends GridMetadataAwareAdapter implements Cluste * * @param metrics Node metrics. */ - public void setMetrics(ClusterNodeMetrics metrics) { + public void setMetrics(ClusterNodeMetricsMBean metrics) { assert metrics != null; this.metrics = metrics; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java index 6aa2e74..52234b8 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/messages/TcpDiscoveryHeartbeatMessage.java @@ -79,7 +79,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage { * @param nodeId Node ID. * @param metrics Node metrics. */ - public void setMetrics(UUID nodeId, ClusterNodeMetrics metrics) { + public void setMetrics(UUID nodeId, ClusterNodeMetricsMBean metrics) { assert nodeId != null; assert metrics != null; assert !this.metrics.containsKey(nodeId); @@ -94,7 +94,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage { * @param clientNodeId Client node ID. * @param metrics Node metrics. */ - public void setClientMetrics(UUID nodeId, UUID clientNodeId, ClusterNodeMetrics metrics) { + public void setClientMetrics(UUID nodeId, UUID clientNodeId, ClusterNodeMetricsMBean metrics) { assert nodeId != null; assert clientNodeId != null; assert metrics != null; @@ -196,7 +196,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage { * @param metrics Metrics. * @return Serialized metrics. */ - private static byte[] serializeMetrics(ClusterNodeMetrics metrics) { + private static byte[] serializeMetrics(ClusterNodeMetricsMBean metrics) { assert metrics != null; byte[] buf = new byte[DiscoveryMetricsHelper.METRICS_SIZE]; @@ -211,7 +211,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage { * @param metrics Metrics. * @return Serialized metrics. */ - private static byte[] serializeMetrics(UUID nodeId, ClusterNodeMetrics metrics) { + private static byte[] serializeMetrics(UUID nodeId, ClusterNodeMetricsMBean metrics) { assert nodeId != null; assert metrics != null; @@ -247,7 +247,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage { /** * @param metrics Metrics. */ - public MetricsSet(ClusterNodeMetrics metrics) { + public MetricsSet(ClusterNodeMetricsMBean metrics) { assert metrics != null; this.metrics = serializeMetrics(metrics); @@ -256,16 +256,16 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage { /** * @return Deserialized metrics. */ - public ClusterNodeMetrics metrics() { + public ClusterNodeMetricsMBean metrics() { return deserialize(metrics, 0); } /** * @return Client metrics. */ - public Collection<T2<UUID, ClusterNodeMetrics>> clientMetrics() { - return F.viewReadOnly(clientMetrics, new C1<byte[], T2<UUID, ClusterNodeMetrics>>() { - @Override public T2<UUID, ClusterNodeMetrics> apply(byte[] bytes) { + public Collection<T2<UUID, ClusterNodeMetricsMBean>> clientMetrics() { + return F.viewReadOnly(clientMetrics, new C1<byte[], T2<UUID, ClusterNodeMetricsMBean>>() { + @Override public T2<UUID, ClusterNodeMetricsMBean> apply(byte[] bytes) { UUID nodeId = new UUID(U.bytesToLong(bytes, 0), U.bytesToLong(bytes, 8)); return new T2<>(nodeId, deserialize(bytes, 16)); @@ -277,7 +277,7 @@ public class TcpDiscoveryHeartbeatMessage extends TcpDiscoveryAbstractMessage { * @param nodeId Client node ID. * @param metrics Client metrics. */ - private void addClientMetrics(UUID nodeId, ClusterNodeMetrics metrics) { + private void addClientMetrics(UUID nodeId, ClusterNodeMetricsMBean metrics) { assert nodeId != null; assert metrics != null; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbe.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbe.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbe.java index 10439b4..85ea9ea 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbe.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveCpuLoadProbe.java @@ -214,7 +214,7 @@ public class AdaptiveCpuLoadProbe implements AdaptiveLoadProbe { /** {@inheritDoc} */ @Override public double getLoad(ClusterNode node, int jobsSentSinceLastUpdate) { - ClusterNodeMetrics metrics = node.metrics(); + ClusterNodeMetricsMBean metrics = node.metrics(); double k = 1.0d; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbe.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbe.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbe.java index 9bb49a6..4a56821 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbe.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveJobCountLoadProbe.java @@ -83,7 +83,7 @@ public class AdaptiveJobCountLoadProbe implements AdaptiveLoadProbe { /** {@inheritDoc} */ @Override public double getLoad(ClusterNode node, int jobsSentSinceLastUpdate) { - ClusterNodeMetrics metrics = node.metrics(); + ClusterNodeMetricsMBean metrics = node.metrics(); if (useAvg) { double load = metrics.getAverageActiveJobs() + metrics.getAverageWaitingJobs(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbe.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbe.java b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbe.java index 3b71d44..e8677a4 100644 --- a/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbe.java +++ b/modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveProcessingTimeLoadProbe.java @@ -83,7 +83,7 @@ public class AdaptiveProcessingTimeLoadProbe implements AdaptiveLoadProbe { /** {@inheritDoc} */ @Override public double getLoad(ClusterNode node, int jobsSentSinceLastUpdate) { - ClusterNodeMetrics metrics = node.metrics(); + ClusterNodeMetricsMBean metrics = node.metrics(); if (useAvg) { double load = metrics.getAverageJobExecuteTime() + metrics.getAverageJobWaitTime(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java b/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java index 63710fb..bc7fe2c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/CacheMetricsMxBean.java @@ -17,14 +17,101 @@ package org.gridgain.grid.cache; -import javax.cache.management.*; import org.apache.ignite.*; /** * Cache metrics used to obtain statistics on cache itself. * Use {@link IgniteCache#metrics()} to obtain metrics for a cache. */ -public interface CacheMetricsMxBean extends CacheStatisticsMXBean { +public interface CacheMetricsMxBean { + /** + * Clears the statistics counters to 0 for the associated Cache. + */ + void clear(); + + /** + * The number of get requests that were satisfied by the cache. + * + * @return the number of hits + */ + long getCacheHits(); + + /** + * This is a measure of cache efficiency. + * + * @return the percentage of successful hits, as a decimal e.g 75. + */ + float getCacheHitPercentage(); + + /** + * A miss is a get request that is not satisfied. + * + * @return the number of misses + */ + long getCacheMisses(); + + /** + * Returns the percentage of cache accesses that did not find a requested entry + * in the cache. + * + * @return the percentage of accesses that failed to find anything + */ + float getCacheMissPercentage(); + + /** + * The total number of requests to the cache. This will be equal to the sum of + * the hits and misses. + * + * @return the number of gets + */ + long getCacheGets(); + + /** + * The total number of puts to the cache. + * + * @return the number of puts + */ + long getCachePuts(); + + /** + * The total number of removals from the cache. This does not include evictions, + * where the cache itself initiates the removal to make space. + * + * @return the number of removals + */ + long getCacheRemovals(); + + /** + * The total number of evictions from the cache. An eviction is a removal + * initiated by the cache itself to free up space. An eviction is not treated as + * a removal and does not appear in the removal counts. + * + * @return the number of evictions + */ + long getCacheEvictions(); + + /** + * The mean time to execute gets. + * + * @return the time in µs + */ + float getAverageGetTime(); + + /** + * The mean time to execute puts. + * + * @return the time in µs + */ + float getAveragePutTime(); + + /** + * The mean time to execute removes. + * + * @return the time in µs + */ + float getAverageRemoveTime(); + + /** * The mean time to execute tx commit. * @@ -45,12 +132,12 @@ public interface CacheMetricsMxBean extends CacheStatisticsMXBean { * * @return Number of transaction commits. */ - public int getCacheTxCommits(); + public long getCacheTxCommits(); /** * Gets total number of transaction rollbacks. * * @return Number of transaction rollbacks. */ - public int getCacheTxRollbacks(); + public long getCacheTxRollbacks(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e2a599ec/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java index 753217f..1d76657 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/GridCache.java @@ -271,9 +271,4 @@ public interface GridCache<K, V> extends GridCacheProjection<K, V> { * @return Future that will be completed when preloading is finished. */ public IgniteFuture<?> forceRepartition(); - - /** - * Resets metrics for current cache. - */ - public void resetMetrics(); }