ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [1/2] ignite git commit: IGNITE-1071 IgniteCache.metrics() method returns local metrics
Date Thu, 24 Mar 2016 15:58:42 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1071 5069a2da1 -> bee462ee4


IGNITE-1071 IgniteCache.metrics() method returns local metrics


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/07b0965f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/07b0965f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/07b0965f

Branch: refs/heads/ignite-1071
Commit: 07b0965fe3adf9c3b7b46506b6c3aacdc88d86bc
Parents: 5069a2d
Author: Anton Vinogradov <av@apache.org>
Authored: Thu Mar 24 18:25:31 2016 +0300
Committer: Anton Vinogradov <av@apache.org>
Committed: Thu Mar 24 18:25:31 2016 +0300

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         |   2 +-
 .../cache/CacheClusterMetricsMXBeanImpl.java    | 410 +++++++++++++++++++
 .../cache/CacheLocalMetricsMXBeanImpl.java      | 410 +++++++++++++++++++
 .../cache/CacheMetricsMXBeanImpl.java           | 410 -------------------
 .../processors/cache/GridCacheAdapter.java      |  43 +-
 .../processors/cache/GridCacheProcessor.java    |  12 +-
 .../processors/cache/GridCacheProxyImpl.java    |  45 +-
 .../processors/cache/IgniteCacheProxy.java      |  19 +-
 .../processors/cache/IgniteInternalCache.java   |  31 +-
 .../handlers/cache/GridCacheCommandHandler.java |   2 +-
 .../visor/cache/VisorCacheResetMetricsTask.java |   2 +-
 .../cache/GridCacheAbstractMetricsSelfTest.java |  12 +-
 12 files changed, 946 insertions(+), 452 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index b55ffb0..b6db285 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -910,7 +910,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
                         if (metrics == null)
                             metrics = U.newHashMap(caches.size());
 
-                        metrics.put(cache.context().cacheId(), cache.metrics());
+                        metrics.put(cache.context().cacheId(), cache.localMetrics());
                     }
                 }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheClusterMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheClusterMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheClusterMetricsMXBeanImpl.java
new file mode 100644
index 0000000..d99ea67
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheClusterMetricsMXBeanImpl.java
@@ -0,0 +1,410 @@
+/*
+ * 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.internal.processors.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.mxbean.CacheMetricsMXBean;
+
+/**
+ * Management bean that provides access to {@link IgniteCache IgniteCache}.
+ */
+class CacheClusterMetricsMXBeanImpl implements CacheMetricsMXBean {
+    /** Cache. */
+    private GridCacheAdapter<?, ?> cache;
+
+    /**
+     * Creates MBean;
+     *
+     * @param cache Cache.
+     */
+    CacheClusterMetricsMXBeanImpl(GridCacheAdapter<?, ?> cache) {
+        assert cache != null;
+
+        this.cache = cache;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return cache.clusterMetrics().name();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOverflowSize() {
+        return cache.clusterMetrics().getOverflowSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapGets() {
+        return cache.clusterMetrics().getOffHeapGets();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapPuts() {
+        return cache.clusterMetrics().getOffHeapPuts();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapRemovals() {
+        return cache.clusterMetrics().getOffHeapRemovals();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapEvictions() {
+        return cache.clusterMetrics().getOffHeapEvictions();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapHits() {
+        return cache.clusterMetrics().getOffHeapHits();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getOffHeapHitPercentage() {
+        return cache.clusterMetrics().getOffHeapHitPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapMisses() {
+        return cache.clusterMetrics().getOffHeapMisses();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getOffHeapMissPercentage() {
+        return cache.clusterMetrics().getOffHeapMissPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapEntriesCount() {
+        return cache.clusterMetrics().getOffHeapEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapPrimaryEntriesCount() {
+        return cache.clusterMetrics().getOffHeapPrimaryEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapBackupEntriesCount() {
+        return cache.clusterMetrics().getOffHeapBackupEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapAllocatedSize() {
+        return cache.clusterMetrics().getOffHeapAllocatedSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapMaxSize() {
+        return cache.clusterMetrics().getOffHeapMaxSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapGets() {
+        return cache.clusterMetrics().getSwapGets();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapPuts() {
+        return cache.clusterMetrics().getSwapPuts();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapRemovals() {
+        return cache.clusterMetrics().getSwapRemovals();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapHits() {
+        return cache.clusterMetrics().getSwapHits();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapMisses() {
+        return cache.clusterMetrics().getSwapMisses();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getSwapHitPercentage() {
+        return cache.clusterMetrics().getSwapHitPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getSwapMissPercentage() {
+        return cache.clusterMetrics().getSwapMissPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapEntriesCount() {
+        return cache.clusterMetrics().getSwapEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapSize() {
+        return cache.clusterMetrics().getSwapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getSize() {
+        return cache.clusterMetrics().getSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getKeySize() {
+        return cache.clusterMetrics().getKeySize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isEmpty() {
+        return cache.clusterMetrics().isEmpty();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getDhtEvictQueueCurrentSize() {
+        return cache.clusterMetrics().getDhtEvictQueueCurrentSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxCommitQueueSize() {
+        return cache.clusterMetrics().getTxCommitQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxThreadMapSize() {
+        return cache.clusterMetrics().getTxThreadMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxXidMapSize() {
+        return cache.clusterMetrics().getTxXidMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxPrepareQueueSize() {
+        return cache.clusterMetrics().getTxPrepareQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxStartVersionCountsSize() {
+        return cache.clusterMetrics().getTxStartVersionCountsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxCommittedVersionsSize() {
+        return cache.clusterMetrics().getTxCommittedVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxRolledbackVersionsSize() {
+        return cache.clusterMetrics().getTxRolledbackVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtThreadMapSize() {
+        return cache.clusterMetrics().getTxDhtThreadMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtXidMapSize() {
+        return cache.clusterMetrics().getTxDhtXidMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtCommitQueueSize() {
+        return cache.clusterMetrics().getTxDhtCommitQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtPrepareQueueSize() {
+        return cache.clusterMetrics().getTxDhtPrepareQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtStartVersionCountsSize() {
+        return cache.clusterMetrics().getTxDhtStartVersionCountsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtCommittedVersionsSize() {
+        return cache.clusterMetrics().getTxDhtCommittedVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtRolledbackVersionsSize() {
+        return cache.clusterMetrics().getTxDhtRolledbackVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWriteBehindEnabled() {
+        return cache.clusterMetrics().isWriteBehindEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindFlushSize() {
+        return cache.clusterMetrics().getWriteBehindFlushSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindFlushThreadCount() {
+        return cache.clusterMetrics().getWriteBehindFlushThreadCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getWriteBehindFlushFrequency() {
+        return cache.clusterMetrics().getWriteBehindFlushFrequency();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindStoreBatchSize() {
+        return cache.clusterMetrics().getWriteBehindStoreBatchSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindTotalCriticalOverflowCount() {
+        return cache.clusterMetrics().getWriteBehindTotalCriticalOverflowCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindCriticalOverflowCount() {
+        return cache.clusterMetrics().getWriteBehindCriticalOverflowCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindErrorRetryCount() {
+        return cache.clusterMetrics().getWriteBehindErrorRetryCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindBufferSize() {
+        return cache.clusterMetrics().getWriteBehindBufferSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clear() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheHits() {
+        return cache.clusterMetrics().getCacheHits();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getCacheHitPercentage() {
+        return cache.clusterMetrics().getCacheHitPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheMisses() {
+        return cache.clusterMetrics().getCacheMisses();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getCacheMissPercentage() {
+        return cache.clusterMetrics().getCacheMissPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheGets() {
+        return cache.clusterMetrics().getCacheGets();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCachePuts() {
+        return cache.clusterMetrics().getCachePuts();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheRemovals() {
+        return cache.clusterMetrics().getCacheRemovals();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheEvictions() {
+        return cache.clusterMetrics().getCacheEvictions();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageGetTime() {
+        return cache.clusterMetrics().getAverageGetTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAveragePutTime() {
+        return cache.clusterMetrics().getAveragePutTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageRemoveTime() {
+        return cache.clusterMetrics().getAverageRemoveTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageTxCommitTime() {
+        return cache.clusterMetrics().getAverageTxCommitTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageTxRollbackTime() {
+        return cache.clusterMetrics().getAverageTxRollbackTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheTxCommits() {
+        return cache.clusterMetrics().getCacheTxCommits();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheTxRollbacks() {
+        return cache.clusterMetrics().getCacheTxRollbacks();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getKeyType() {
+        return cache.clusterMetrics().getKeyType();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getValueType() {
+        return cache.clusterMetrics().getValueType();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isStoreByValue() {
+        return cache.clusterMetrics().isStoreByValue();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isStatisticsEnabled() {
+        return cache.clusterMetrics().isStatisticsEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isManagementEnabled() {
+        return cache.clusterMetrics().isManagementEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isReadThrough() {
+        return cache.clusterMetrics().isReadThrough();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWriteThrough() {
+        return cache.clusterMetrics().isWriteThrough();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLocalMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLocalMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLocalMetricsMXBeanImpl.java
new file mode 100644
index 0000000..5284ca0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLocalMetricsMXBeanImpl.java
@@ -0,0 +1,410 @@
+/*
+ * 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.internal.processors.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.mxbean.CacheMetricsMXBean;
+
+/**
+ * Management bean that provides access to {@link IgniteCache IgniteCache}.
+ */
+class CacheLocalMetricsMXBeanImpl implements CacheMetricsMXBean {
+    /** Cache. */
+    private GridCacheAdapter<?, ?> cache;
+
+    /**
+     * Creates MBean;
+     *
+     * @param cache Cache.
+     */
+    CacheLocalMetricsMXBeanImpl(GridCacheAdapter<?, ?> cache) {
+        assert cache != null;
+
+        this.cache = cache;
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return cache.metrics0().name();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOverflowSize() {
+        return cache.metrics0().getOverflowSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapGets() {
+        return cache.metrics0().getOffHeapGets();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapPuts() {
+        return cache.metrics0().getOffHeapPuts();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapRemovals() {
+        return cache.metrics0().getOffHeapRemovals();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapEvictions() {
+        return cache.metrics0().getOffHeapEvictions();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapHits() {
+        return cache.metrics0().getOffHeapHits();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getOffHeapHitPercentage() {
+        return cache.metrics0().getOffHeapHitPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapMisses() {
+        return cache.metrics0().getOffHeapMisses();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getOffHeapMissPercentage() {
+        return cache.metrics0().getOffHeapMissPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapEntriesCount() {
+        return cache.metrics0().getOffHeapEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapPrimaryEntriesCount() {
+        return cache.metrics0().getOffHeapPrimaryEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapBackupEntriesCount() {
+        return cache.metrics0().getOffHeapBackupEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapAllocatedSize() {
+        return cache.metrics0().getOffHeapAllocatedSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getOffHeapMaxSize() {
+        return cache.metrics0().getOffHeapMaxSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapGets() {
+        return cache.metrics0().getSwapGets();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapPuts() {
+        return cache.metrics0().getSwapPuts();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapRemovals() {
+        return cache.metrics0().getSwapRemovals();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapHits() {
+        return cache.metrics0().getSwapHits();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapMisses() {
+        return cache.metrics0().getSwapMisses();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getSwapHitPercentage() {
+        return cache.metrics0().getSwapHitPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getSwapMissPercentage() {
+        return cache.metrics0().getSwapMissPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapEntriesCount() {
+        return cache.metrics0().getSwapEntriesCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getSwapSize() {
+        return cache.metrics0().getSwapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getSize() {
+        return cache.metrics0().getSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getKeySize() {
+        return cache.metrics0().getKeySize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isEmpty() {
+        return cache.metrics0().isEmpty();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getDhtEvictQueueCurrentSize() {
+        return cache.metrics0().getDhtEvictQueueCurrentSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxCommitQueueSize() {
+        return cache.metrics0().getTxCommitQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxThreadMapSize() {
+        return cache.metrics0().getTxThreadMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxXidMapSize() {
+        return cache.metrics0().getTxXidMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxPrepareQueueSize() {
+        return cache.metrics0().getTxPrepareQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxStartVersionCountsSize() {
+        return cache.metrics0().getTxStartVersionCountsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxCommittedVersionsSize() {
+        return cache.metrics0().getTxCommittedVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxRolledbackVersionsSize() {
+        return cache.metrics0().getTxRolledbackVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtThreadMapSize() {
+        return cache.metrics0().getTxDhtThreadMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtXidMapSize() {
+        return cache.metrics0().getTxDhtXidMapSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtCommitQueueSize() {
+        return cache.metrics0().getTxDhtCommitQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtPrepareQueueSize() {
+        return cache.metrics0().getTxDhtPrepareQueueSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtStartVersionCountsSize() {
+        return cache.metrics0().getTxDhtStartVersionCountsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtCommittedVersionsSize() {
+        return cache.metrics0().getTxDhtCommittedVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getTxDhtRolledbackVersionsSize() {
+        return cache.metrics0().getTxDhtRolledbackVersionsSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWriteBehindEnabled() {
+        return cache.metrics0().isWriteBehindEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindFlushSize() {
+        return cache.metrics0().getWriteBehindFlushSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindFlushThreadCount() {
+        return cache.metrics0().getWriteBehindFlushThreadCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getWriteBehindFlushFrequency() {
+        return cache.metrics0().getWriteBehindFlushFrequency();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindStoreBatchSize() {
+        return cache.metrics0().getWriteBehindStoreBatchSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindTotalCriticalOverflowCount() {
+        return cache.metrics0().getWriteBehindTotalCriticalOverflowCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindCriticalOverflowCount() {
+        return cache.metrics0().getWriteBehindCriticalOverflowCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindErrorRetryCount() {
+        return cache.metrics0().getWriteBehindErrorRetryCount();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int getWriteBehindBufferSize() {
+        return cache.metrics0().getWriteBehindBufferSize();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void clear() {
+        cache.metrics0().clear();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheHits() {
+        return cache.metrics0().getCacheHits();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getCacheHitPercentage() {
+        return cache.metrics0().getCacheHitPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheMisses() {
+        return cache.metrics0().getCacheMisses();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getCacheMissPercentage() {
+        return cache.metrics0().getCacheMissPercentage();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheGets() {
+        return cache.metrics0().getCacheGets();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCachePuts() {
+        return cache.metrics0().getCachePuts();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheRemovals() {
+        return cache.metrics0().getCacheRemovals();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheEvictions() {
+        return cache.metrics0().getCacheEvictions();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageGetTime() {
+        return cache.metrics0().getAverageGetTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAveragePutTime() {
+        return cache.metrics0().getAveragePutTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageRemoveTime() {
+        return cache.metrics0().getAverageRemoveTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageTxCommitTime() {
+        return cache.metrics0().getAverageTxCommitTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public float getAverageTxRollbackTime() {
+        return cache.metrics0().getAverageTxRollbackTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheTxCommits() {
+        return cache.metrics0().getCacheTxCommits();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long getCacheTxRollbacks() {
+        return cache.metrics0().getCacheTxRollbacks();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getKeyType() {
+        return cache.metrics0().getKeyType();
+    }
+
+    /** {@inheritDoc} */
+    @Override public String getValueType() {
+        return cache.metrics0().getValueType();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isStoreByValue() {
+        return cache.metrics0().isStoreByValue();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isStatisticsEnabled() {
+        return cache.metrics0().isStatisticsEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isManagementEnabled() {
+        return cache.metrics0().isManagementEnabled();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isReadThrough() {
+        return cache.metrics0().isReadThrough();
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean isWriteThrough() {
+        return cache.metrics0().isWriteThrough();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsMXBeanImpl.java
deleted file mode 100644
index 822240e..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheMetricsMXBeanImpl.java
+++ /dev/null
@@ -1,410 +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.internal.processors.cache;
-
-import org.apache.ignite.IgniteCache;
-import org.apache.ignite.mxbean.CacheMetricsMXBean;
-
-/**
- * Management bean that provides access to {@link IgniteCache IgniteCache}.
- */
-class CacheMetricsMXBeanImpl implements CacheMetricsMXBean {
-    /** Cache. */
-    private GridCacheAdapter<?, ?> cache;
-
-    /**
-     * Creates MBean;
-     *
-     * @param cache Cache.
-     */
-    CacheMetricsMXBeanImpl(GridCacheAdapter<?, ?> cache) {
-        assert cache != null;
-
-        this.cache = cache;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String name() {
-        return cache.metrics0().name();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOverflowSize() {
-        return cache.metrics0().getOverflowSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapGets() {
-        return cache.metrics0().getOffHeapGets();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapPuts() {
-        return cache.metrics0().getOffHeapPuts();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapRemovals() {
-        return cache.metrics0().getOffHeapRemovals();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapEvictions() {
-        return cache.metrics0().getOffHeapEvictions();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapHits() {
-        return cache.metrics0().getOffHeapHits();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getOffHeapHitPercentage() {
-        return cache.metrics0().getOffHeapHitPercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapMisses() {
-        return cache.metrics0().getOffHeapMisses();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getOffHeapMissPercentage() {
-        return cache.metrics0().getOffHeapMissPercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapEntriesCount() {
-        return cache.metrics0().getOffHeapEntriesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapPrimaryEntriesCount() {
-        return cache.metrics0().getOffHeapPrimaryEntriesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapBackupEntriesCount() {
-        return cache.metrics0().getOffHeapBackupEntriesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapAllocatedSize() {
-        return cache.metrics0().getOffHeapAllocatedSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getOffHeapMaxSize() {
-        return cache.metrics0().getOffHeapMaxSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSwapGets() {
-        return cache.metrics0().getSwapGets();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSwapPuts() {
-        return cache.metrics0().getSwapPuts();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSwapRemovals() {
-        return cache.metrics0().getSwapRemovals();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSwapHits() {
-        return cache.metrics0().getSwapHits();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSwapMisses() {
-        return cache.metrics0().getSwapMisses();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getSwapHitPercentage() {
-        return cache.metrics0().getSwapHitPercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getSwapMissPercentage() {
-        return cache.metrics0().getSwapMissPercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSwapEntriesCount() {
-        return cache.metrics0().getSwapEntriesCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getSwapSize() {
-        return cache.metrics0().getSwapSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getSize() {
-        return cache.metrics0().getSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getKeySize() {
-        return cache.metrics0().getKeySize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isEmpty() {
-        return cache.metrics0().isEmpty();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getDhtEvictQueueCurrentSize() {
-        return cache.metrics0().getDhtEvictQueueCurrentSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxCommitQueueSize() {
-        return cache.metrics0().getTxCommitQueueSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxThreadMapSize() {
-        return cache.metrics0().getTxThreadMapSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxXidMapSize() {
-        return cache.metrics0().getTxXidMapSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxPrepareQueueSize() {
-        return cache.metrics0().getTxPrepareQueueSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxStartVersionCountsSize() {
-        return cache.metrics0().getTxStartVersionCountsSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxCommittedVersionsSize() {
-        return cache.metrics0().getTxCommittedVersionsSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxRolledbackVersionsSize() {
-        return cache.metrics0().getTxRolledbackVersionsSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxDhtThreadMapSize() {
-        return cache.metrics0().getTxDhtThreadMapSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxDhtXidMapSize() {
-        return cache.metrics0().getTxDhtXidMapSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxDhtCommitQueueSize() {
-        return cache.metrics0().getTxDhtCommitQueueSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxDhtPrepareQueueSize() {
-        return cache.metrics0().getTxDhtPrepareQueueSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxDhtStartVersionCountsSize() {
-        return cache.metrics0().getTxDhtStartVersionCountsSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxDhtCommittedVersionsSize() {
-        return cache.metrics0().getTxDhtCommittedVersionsSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getTxDhtRolledbackVersionsSize() {
-        return cache.metrics0().getTxDhtRolledbackVersionsSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isWriteBehindEnabled() {
-        return cache.metrics0().isWriteBehindEnabled();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getWriteBehindFlushSize() {
-        return cache.metrics0().getWriteBehindFlushSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getWriteBehindFlushThreadCount() {
-        return cache.metrics0().getWriteBehindFlushThreadCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getWriteBehindFlushFrequency() {
-        return cache.metrics0().getWriteBehindFlushFrequency();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getWriteBehindStoreBatchSize() {
-        return cache.metrics0().getWriteBehindStoreBatchSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getWriteBehindTotalCriticalOverflowCount() {
-        return cache.metrics0().getWriteBehindTotalCriticalOverflowCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getWriteBehindCriticalOverflowCount() {
-        return cache.metrics0().getWriteBehindCriticalOverflowCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getWriteBehindErrorRetryCount() {
-        return cache.metrics0().getWriteBehindErrorRetryCount();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int getWriteBehindBufferSize() {
-        return cache.metrics0().getWriteBehindBufferSize();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void clear() {
-        cache.metrics0().clear();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheHits() {
-        return cache.metrics0().getCacheHits();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getCacheHitPercentage() {
-        return cache.metrics0().getCacheHitPercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheMisses() {
-        return cache.metrics0().getCacheMisses();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getCacheMissPercentage() {
-        return cache.metrics0().getCacheMissPercentage();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheGets() {
-        return cache.metrics0().getCacheGets();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCachePuts() {
-        return cache.metrics0().getCachePuts();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheRemovals() {
-        return cache.metrics0().getCacheRemovals();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheEvictions() {
-        return cache.metrics0().getCacheEvictions();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageGetTime() {
-        return cache.metrics0().getAverageGetTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAveragePutTime() {
-        return cache.metrics0().getAveragePutTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageRemoveTime() {
-        return cache.metrics0().getAverageRemoveTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageTxCommitTime() {
-        return cache.metrics0().getAverageTxCommitTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public float getAverageTxRollbackTime() {
-        return cache.metrics0().getAverageTxRollbackTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheTxCommits() {
-        return cache.metrics0().getCacheTxCommits();
-    }
-
-    /** {@inheritDoc} */
-    @Override public long getCacheTxRollbacks() {
-        return cache.metrics0().getCacheTxRollbacks();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getKeyType() {
-        return cache.metrics0().getKeyType();
-    }
-
-    /** {@inheritDoc} */
-    @Override public String getValueType() {
-        return cache.metrics0().getValueType();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isStoreByValue() {
-        return cache.metrics0().isStoreByValue();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isStatisticsEnabled() {
-        return cache.metrics0().isStatisticsEnabled();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isManagementEnabled() {
-        return cache.metrics0().isManagementEnabled();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isReadThrough() {
-        return cache.metrics0().isReadThrough();
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean isWriteThrough() {
-        return cache.metrics0().isWriteThrough();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 54046a9..a7b9a26 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -138,6 +138,7 @@ import org.apache.ignite.mxbean.CacheMetricsMXBean;
 import org.apache.ignite.plugin.security.SecurityPermission;
 import org.apache.ignite.resources.IgniteInstanceResource;
 import org.apache.ignite.resources.JobContextResource;
+import org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode;
 import org.apache.ignite.transactions.Transaction;
 import org.apache.ignite.transactions.TransactionConcurrency;
 import org.apache.ignite.transactions.TransactionIsolation;
@@ -257,8 +258,11 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     /** Cache metrics. */
     protected CacheMetricsImpl metrics;
 
+    /** Cache localMxBean. */
+    protected CacheMetricsMXBean localMxBean;
+
     /** Cache mxBean. */
-    protected CacheMetricsMXBean mxBean;
+    protected CacheMetricsMXBean clusterMxBean;
 
     /** Logger. */
     protected IgniteLogger log;
@@ -328,7 +332,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
 
         metrics = new CacheMetricsImpl(ctx);
 
-        mxBean = new CacheMetricsMXBeanImpl(this);
+        localMxBean = new CacheLocalMetricsMXBeanImpl(this);
+        clusterMxBean = new CacheClusterMetricsMXBeanImpl(this);
 
         FileSystemConfiguration[] igfsCfgs = gridCfg.getFileSystemConfiguration();
 
@@ -3340,13 +3345,41 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
     }
 
     /** {@inheritDoc} */
-    @Override public CacheMetrics metrics() {
+    @Override public CacheMetrics clusterMetrics() {
+        return clusterMetrics(ctx.grid().cluster().forCacheNodes(ctx.name()));
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetrics clusterMetrics(ClusterGroup grp) {
+        List<CacheMetrics> metrics = new ArrayList<>(grp.nodes().size());
+
+        for (ClusterNode node : grp.nodes()) {
+            Map<Integer, CacheMetrics> nodeCacheMetrics = ((TcpDiscoveryNode)node).cacheMetrics();
+
+            if (nodeCacheMetrics != null) {
+                CacheMetrics e = nodeCacheMetrics.get(context().cacheId());
+
+                if (e != null)
+                    metrics.add(e);
+            }
+        }
+
+        return new CacheMetricsSnapshot(ctx.cache().localMetrics(), metrics);
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetrics localMetrics() {
         return new CacheMetricsSnapshot(metrics);
     }
 
     /** {@inheritDoc} */
-    @Override public CacheMetricsMXBean mxBean() {
-        return mxBean;
+    @Override public CacheMetricsMXBean localMxBean() {
+        return localMxBean;
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetricsMXBean clusterMxBean() {
+        return clusterMxBean;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index a8f3a4a..49db074 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -539,8 +539,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         cleanup(cfg, cfg.getAffinityMapper(), false);
         cleanup(cfg, cctx.store().configuredStore(), false);
 
-        if (!CU.isUtilityCache(cfg.getName()) && !CU.isSystemCache(cfg.getName()))
-            unregisterMbean(cctx.cache().mxBean(), cfg.getName(), false);
+        if (!CU.isUtilityCache(cfg.getName()) && !CU.isSystemCache(cfg.getName())) {
+            unregisterMbean(cctx.cache().localMxBean(), cfg.getName(), false);
+            unregisterMbean(cctx.cache().clusterMxBean(), cfg.getName(), false);
+        }
 
         NearCacheConfiguration nearCfg = cfg.getNearConfiguration();
 
@@ -1478,8 +1480,10 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             cacheCtx.cache(dht);
         }
 
-        if (!CU.isUtilityCache(cache.name()) && !CU.isSystemCache(cache.name()))
-            registerMbean(cache.mxBean(), cache.name(), false);
+        if (!CU.isUtilityCache(cache.name()) && !CU.isSystemCache(cache.name())) {
+            registerMbean(cache.localMxBean(), cache.name(), false);
+            registerMbean(cache.clusterMxBean(), cache.name(), false);
+        }
 
         return ret;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
index 9b4aff3..cbe16c6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java
@@ -35,6 +35,7 @@ import org.apache.ignite.cache.CacheEntry;
 import org.apache.ignite.cache.CacheMetrics;
 import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.cache.affinity.Affinity;
+import org.apache.ignite.cluster.ClusterGroup;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
@@ -143,16 +144,52 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
     }
 
     /** {@inheritDoc} */
+    @Override public CacheMetrics clusterMetrics() {
+        CacheOperationContext prev = gate.enter(opCtx);
+
+        try {
+            return delegate.clusterMetrics();
+        }
+        finally {
+            gate.leave(prev);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetrics clusterMetrics(ClusterGroup grp) {
+        CacheOperationContext prev = gate.enter(opCtx);
+
+        try {
+            return delegate.clusterMetrics(grp);
+        }
+        finally {
+            gate.leave(prev);
+        }
+    }
+
+    /** {@inheritDoc} */
     @Override public CacheConfiguration configuration() {
         return delegate.configuration();
     }
 
     /** {@inheritDoc} */
-    @Override public CacheMetrics metrics() {
+    @Override public CacheMetrics localMetrics() {
+        CacheOperationContext prev = gate.enter(opCtx);
+
+        try {
+            return delegate.localMetrics();
+        }
+        finally {
+            gate.leave(prev);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public CacheMetricsMXBean clusterMxBean() {
         CacheOperationContext prev = gate.enter(opCtx);
 
         try {
-            return delegate.metrics();
+            return delegate.clusterMxBean();
         }
         finally {
             gate.leave(prev);
@@ -160,11 +197,11 @@ public class GridCacheProxyImpl<K, V> implements IgniteInternalCache<K, V>, Exte
     }
 
     /** {@inheritDoc} */
-    @Override public CacheMetricsMXBean mxBean() {
+    @Override public CacheMetricsMXBean localMxBean() {
         CacheOperationContext prev = gate.enter(opCtx);
 
         try {
-            return delegate.mxBean();
+            return delegate.localMxBean();
         }
         finally {
             gate.leave(prev);

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index b29014b..d617d26 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -222,7 +222,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
         CacheOperationContext prev = onEnter(gate, opCtx);
 
         try {
-            return metrics(ctx.grid().cluster().forCacheNodes(ctx.name()));
+            return ctx.cache().clusterMetrics();
         }
         finally {
             onLeave(gate, prev);
@@ -236,20 +236,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
         CacheOperationContext prev = onEnter(gate, opCtx);
 
         try {
-            List<CacheMetrics> metrics = new ArrayList<>(grp.nodes().size());
-
-            for (ClusterNode node : grp.nodes()) {
-                Map<Integer, CacheMetrics> nodeCacheMetrics = ((TcpDiscoveryNode)node).cacheMetrics();
-
-                if (nodeCacheMetrics != null) {
-                    CacheMetrics e = nodeCacheMetrics.get(context().cacheId());
-
-                    if (e != null)
-                        metrics.add(e);
-                }
-            }
-
-            return new CacheMetricsSnapshot(ctx.cache().metrics(), metrics);
+            return ctx.cache().clusterMetrics(grp);
         }
         finally {
             onLeave(gate, prev);
@@ -263,7 +250,7 @@ public class IgniteCacheProxy<K, V> extends AsyncSupportAdapter<IgniteCache<K, V
         CacheOperationContext prev = onEnter(gate, opCtx);
 
         try {
-            return ctx.cache().mxBean();
+            return ctx.cache().clusterMxBean();
         }
         finally {
             onLeave(gate, prev);

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
index 68d0f06..d2e0101 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java
@@ -38,6 +38,7 @@ import org.apache.ignite.cache.CachePeekMode;
 import org.apache.ignite.cache.affinity.Affinity;
 import org.apache.ignite.cache.affinity.AffinityKeyMapped;
 import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.cluster.ClusterGroup;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.configuration.IgniteConfiguration;
 import org.apache.ignite.internal.IgniteInternalFuture;
@@ -1543,18 +1544,40 @@ public interface IgniteInternalCache<K, V> extends Iterable<Cache.Entry<K, V>> {
     public Affinity<K> affinity();
 
     /**
-     * Gets metrics (statistics) for this cache.
+     * Gets whole cluster metrics (statistics) for this cache.
      *
      * @return Cache metrics.
      */
-    public CacheMetrics metrics();
+    public CacheMetrics clusterMetrics();
 
     /**
-     * Gets metrics (statistics) for this cache.
+     * Gets cluster group metrics (statistics) for this cache.
      *
+     * @param grp Cluster group.
      * @return Cache metrics.
      */
-    public CacheMetricsMXBean mxBean();
+    public CacheMetrics clusterMetrics(ClusterGroup grp);
+
+    /**
+     * Gets local metrics (statistics) for this cache.
+     *
+     * @return Cache metrics.
+     */
+    public CacheMetrics localMetrics();
+
+    /**
+     * Gets whole cluster metrics (statistics) for this cache.
+     *
+     * @return Cache metrics.
+     */
+    public CacheMetricsMXBean clusterMxBean();
+
+    /**
+     * Gets local metrics (statistics) for this cache.
+     *
+     * @return Cache metrics.
+     */
+    public CacheMetricsMXBean localMxBean();
 
     /**
      * Gets size (in bytes) of all entries swapped to disk.

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
index 65dca08..79e1b10 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java
@@ -1484,7 +1484,7 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter {
 
         /** {@inheritDoc} */
         @Override public IgniteInternalFuture<?> applyx(IgniteInternalCache<Object, Object> c, GridKernalContext ctx) {
-            CacheMetrics metrics = c.cache().metrics();
+            CacheMetrics metrics = c.cache().localMetrics();
 
             assert metrics != null;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java
index 9ff4dae..ccec241 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheResetMetricsTask.java
@@ -56,7 +56,7 @@ public class VisorCacheResetMetricsTask extends VisorOneNodeTask<String, Void> {
             IgniteInternalCache cache = ignite.cachex(cacheName);
 
             if (cache != null)
-                cache.mxBean().clear();
+                cache.localMxBean().clear();
 
             return null;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/07b0965f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
index 2026d7f..72813ea 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java
@@ -113,7 +113,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         for (int i = 0; i < gridCount(); i++) {
             Ignite g = grid(i);
 
-            g.cache(null).mxBean().clear();
+            ((IgniteCacheProxy)g.cache(null)).context().cache().metrics0().clear();
 
             g.transactions().resetMetrics();
         }
@@ -570,12 +570,12 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
             expReads += expectedReadsPerPut(isPrimary);
             expMisses += expectedMissesPerPut(isPrimary);
 
-            info("Puts: " + cache0.mxBean().getCachePuts());
+            info("Puts: " + ((IgniteCacheProxy)cache0).context().cache().metrics0().getCachePuts());
 
             for (int j = 0; j < gridCount(); j++) {
                 IgniteCache<Integer, Integer> cache = grid(j).cache(null);
 
-                int cacheWrites = (int)cache.mxBean().getCachePuts();
+                int cacheWrites = (int)((IgniteCacheProxy)cache).context().cache().metrics0().getCachePuts();
 
                 assertEquals("Wrong cache metrics [i=" + i + ", grid=" + j + ']', i + 1, cacheWrites);
             }
@@ -592,7 +592,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         int misses = 0;
 
         for (int i = 0; i < gridCount(); i++) {
-            CacheMetrics m = grid(i).cache(null).mxBean();
+            CacheMetrics m = ((IgniteCacheProxy)grid(i).cache(null)).context().cache().metrics0();
 
             puts += m.getCachePuts();
             reads += m.getCacheGets();
@@ -620,12 +620,12 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract
         for (int i = 0; i < keyCnt; i++) {
             cache0.getAndPut(i, i); // +1 read
 
-            info("Puts: " + cache0.mxBean().getCachePuts());
+            info("Puts: " + ((IgniteCacheProxy)cache0).context().cache().metrics0().getCachePuts());
 
             for (int j = 0; j < gridCount(); j++) {
                 IgniteCache<Integer, Integer> cache = grid(j).cache(null);
 
-                long cacheWrites = cache.mxBean().getCachePuts();
+                long cacheWrites = ((IgniteCacheProxy)cache).context().cache().metrics0().getCachePuts();
 
                 assertEquals("Wrong cache metrics [i=" + i + ", grid=" + j + ']', i + 1, cacheWrites);
             }


Mime
View raw message