ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akuznet...@apache.org
Subject incubator-ignite git commit: # IGNITE-1053 More cache metrics.
Date Thu, 25 Jun 2015 15:40:23 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-1053 [created] 181cbe41b


# IGNITE-1053 More cache metrics.


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

Branch: refs/heads/ignite-1053
Commit: 181cbe41b36808aa718f79cc8807bc7d4db1c215
Parents: e1c49b7
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Thu Jun 25 22:40:15 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Thu Jun 25 22:40:15 2015 +0700

----------------------------------------------------------------------
 .../cache/VisorCacheAggregatedMetrics.java      |  24 +--
 .../internal/visor/cache/VisorCacheMetrics.java | 178 +++++++++++++++++++
 .../commands/cache/VisorCacheCommand.scala      |  16 +-
 3 files changed, 198 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/181cbe41/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
index af68e9f..ffaf5b2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheAggregatedMetrics.java
@@ -197,7 +197,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             minHits = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minHits = Math.min(minHits, metric.hits());
+                minHits = Math.min(minHits, metric.hits() + metric.offHeapHits() + metric.swapHits());
         }
 
         return minHits;
@@ -211,7 +211,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             avgHits = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgHits += metric.hits();
+                avgHits += metric.hits() + metric.offHeapHits() + metric.swapHits();
 
             avgHits /= metrics.size();
         }
@@ -227,7 +227,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             maxHits = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxHits = Math.max(maxHits, metric.hits());
+                maxHits = Math.max(maxHits, metric.hits() + metric.offHeapHits() + metric.swapHits());
         }
 
         return maxHits;
@@ -241,7 +241,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             minMisses = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minMisses = Math.min(minMisses, metric.misses());
+                minMisses = Math.min(minMisses, metric.misses() + metric.offHeapMisses()
+ metric.swapMisses());
         }
 
         return minMisses;
@@ -255,7 +255,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             avgMisses = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgMisses += metric.misses();
+                avgMisses += metric.misses() + metric.offHeapMisses() + metric.swapMisses();
 
             avgMisses /= metrics.size();
         }
@@ -271,7 +271,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             maxMisses = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxMisses = Math.max(maxMisses, metric.misses());
+                maxMisses = Math.max(maxMisses, metric.misses() + metric.offHeapMisses()
+ metric.swapMisses());
         }
 
         return maxMisses;
@@ -285,7 +285,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             minReads = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minReads = Math.min(minReads, metric.reads());
+                minReads = Math.min(minReads, metric.reads() + metric.offHeapReads() + metric.swapReads());
         }
 
         return minReads;
@@ -299,7 +299,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             avgReads = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgReads += metric.reads();
+                avgReads += metric.reads() + metric.offHeapReads() + metric.swapReads();
 
             avgReads /= metrics.size();
         }
@@ -315,7 +315,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             maxReads = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxReads = Math.max(maxReads, metric.reads());
+                maxReads = Math.max(maxReads, metric.reads() + metric.offHeapReads() + metric.swapReads());
         }
 
         return maxReads;
@@ -329,7 +329,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             minWrites = Long.MAX_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                minWrites = Math.min(minWrites, metric.writes());
+                minWrites = Math.min(minWrites, metric.writes() + metric.offHeapWrites()
+ metric.swapWrites());
         }
 
         return minWrites;
@@ -343,7 +343,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             avgWrites = 0.0d;
 
             for (VisorCacheMetrics metric : metrics.values())
-                avgWrites += metric.writes();
+                avgWrites += metric.writes() + metric.offHeapWrites() + metric.swapWrites();
 
             avgWrites /= metrics.size();
         }
@@ -359,7 +359,7 @@ public class VisorCacheAggregatedMetrics implements Serializable {
             maxWrites = Long.MIN_VALUE;
 
             for (VisorCacheMetrics metric : metrics.values())
-                maxWrites = Math.max(maxWrites, metric.writes());
+                maxWrites = Math.max(maxWrites, metric.writes() + metric.offHeapWrites()
+ metric.swapWrites());
         }
 
         return maxWrites;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/181cbe41/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index c5d70a5..ece8cff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -47,24 +47,59 @@ public class VisorCacheMetrics implements Serializable {
     /** Number of non-{@code null} values in the cache. */
     private int size;
 
+    /** Number of primary entries stored in off-heap memory. */
+    private long offHeapPrimarySize;
+
+    /** Number of backup entries stored in off-heap memory. */
+    private long offHeapBackupSize;
+
+    /** Size of swap. */
+    private long swapSize;
+
     /** Gets number of keys in the cache, possibly with {@code null} values. */
     private int keySize;
 
+//    private int swapKeys;
+
     /** Total number of reads of the owning entity (either cache or entry). */
     private long reads;
 
+    /** The total number of get requests to the off-heap memory. */
+    private long offHeapReads;
+
+    /** The total number of get requests to the swap. */
+    private long swapReads;
+
     /** The mean time to execute gets. */
     private float avgReadTime;
 
     /** Total number of writes of the owning entity (either cache or entry). */
     private long writes;
 
+    /** Total number of writes of the owning entity (either cache or entry) from the off-heap
memory. */
+    private long offHeapWrites;
+
+    /** Total number of writes of the owning entity (either cache or entry) from the swap.
*/
+    private long swapWrites;
+
     /** Total number of hits for the owning entity (either cache or entry). */
     private long hits;
 
+    /** The number of get requests that were satisfied by the off-heap memory. */
+    private long offHeapHits;
+
+    /** The number of get requests that were satisfied by the swap. */
+    private long swapHits;
+
     /** Total number of misses for the owning entity (either cache or entry). */
     private long misses;
 
+    /** A miss is a get request that is not satisfied by off-heap memory. */
+    private long offHeapMisses;
+
+    /** A miss is a get request that is not satisfied by swap. */
+    private long swapMisses;
+
     /** Total number of transaction commits. */
     private long txCommits;
 
@@ -80,18 +115,33 @@ public class VisorCacheMetrics implements Serializable {
     /** The total number of puts to the cache. */
     private long puts;
 
+    /** The total number of put requests to the off-heap memory. */
+    private long offHeapPuts;
+
+    /** The total number of put requests to the swap. */
+    private long swapPuts;
+
     /** The mean time to execute puts. */
     private float avgPutTime;
 
     /** The total number of removals from the cache. */
     private long removals;
 
+    /** The total number of removals from the off-heap memory. This does not include evictions.
*/
+    private long offHeapRemovals;
+
+    /** The total number of removals from the swap. */
+    private long swapRemovals;
+
     /** The mean time to execute removes. */
     private float avgRemovalTime;
 
     /** The total number of evictions from the cache. */
     private long evictions;
 
+    /** The total number of evictions from the off-heap memory. */
+    private long offHeapEvictions;
+
     /** Reads per second. */
     private int readsPerSec;
 
@@ -184,12 +234,23 @@ public class VisorCacheMetrics implements Serializable {
         CacheMetrics m = c.metrics();
 
         cm.size = m.getSize();
+        cm.offHeapPrimarySize = m.getOffHeapPrimaryEntriesCount();
+        cm.offHeapBackupSize = m.getOffHeapBackupEntriesCount();
+        cm.swapSize = m.getSwapSize();
         cm.keySize = m.getKeySize();
 
         cm.reads = m.getCacheGets();
+        cm.offHeapReads = m.getOffHeapGets();
+        cm.swapReads = m.getSwapGets();
         cm.writes = m.getCachePuts() + m.getCacheRemovals();
+        cm.offHeapWrites = m.getOffHeapPuts() + m.getOffHeapRemovals();
+        cm.swapWrites = m.getSwapPuts() + m.getSwapRemovals();
         cm.hits = m.getCacheHits();
+        cm.offHeapHits = m.getOffHeapHits();
+        cm.swapHits = m.getOffHeapHits();
         cm.misses = m.getCacheMisses();
+        cm.offHeapMisses = m.getOffHeapMisses();
+        cm.swapMisses = m.getSwapMisses();
 
         cm.txCommits = m.getCacheTxCommits();
         cm.txRollbacks = m.getCacheTxRollbacks();
@@ -198,8 +259,13 @@ public class VisorCacheMetrics implements Serializable {
         cm.avgTxRollbackTime = m.getAverageTxRollbackTime();
 
         cm.puts = m.getCachePuts();
+        cm.offHeapPuts = m.getOffHeapPuts();
+        cm.swapPuts = m.getSwapPuts();
         cm.removals = m.getCacheRemovals();
+        cm.offHeapRemovals = m.getOffHeapRemovals();
+        cm.swapRemovals = m.getSwapRemovals();
         cm.evictions = m.getCacheEvictions();
+        cm.offHeapEvictions = m.getOffHeapEvictions();
 
         cm.avgReadTime = m.getAverageGetTime();
         cm.avgPutTime = m.getAveragePutTime();
@@ -261,6 +327,20 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
+     * @return The total number of get requests to the off-heap memory.
+     */
+    public long offHeapReads() {
+        return offHeapReads;
+    }
+
+    /**
+     * @return The total number of get requests to the swap.
+     */
+    public long swapReads() {
+        return swapReads;
+    }
+
+    /**
      * @return The mean time to execute gets
      */
     public float avgReadTime() {
@@ -275,6 +355,20 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
+     * @return Total number of writes of the owning entity (either cache or entry) from the
off-heap memory.
+     */
+    public long offHeapWrites() {
+        return offHeapWrites;
+    }
+
+    /**
+     * @return Total number of writes of the owning entity (either cache or entry) from the
swap.
+     */
+    public long swapWrites() {
+        return swapWrites;
+    }
+
+    /**
      * @return Total number of hits for the owning entity (either cache or entry).
      */
     public long hits() {
@@ -282,6 +376,20 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
+     * @return The number of get requests that were satisfied by the off-heap memory.
+     */
+    public long offHeapHits() {
+        return offHeapHits;
+    }
+
+    /**
+     * @return The number of get requests that were satisfied by the swap.
+     */
+    public long swapHits() {
+        return swapHits;
+    }
+
+    /**
      * @return Total number of misses for the owning entity (either cache or entry).
      */
     public long misses() {
@@ -289,6 +397,20 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
+     * @return A miss is a get request that is not satisfied by off-heap memory.
+     */
+    public long offHeapMisses() {
+        return offHeapMisses;
+    }
+
+    /**
+     * @return A miss is a get request that is not satisfied by swap.
+     */
+    public long swapMisses() {
+        return swapMisses;
+    }
+
+    /**
      * @return Total number of transaction commits.
      */
     public long txCommits() {
@@ -317,6 +439,20 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
+     * @return The total number of put requests to the off-heap memory.
+     */
+    public long offHeapPuts() {
+        return offHeapPuts;
+    }
+
+    /**
+     * @return The total number of put requests to the swap.
+     */
+    public long swapPuts() {
+        return swapPuts;
+    }
+
+    /**
      * @return The mean time to execute puts.
      */
     public float avgPutTime() {
@@ -331,6 +467,20 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
+     * @return The total number of removals from the off-heap memory. This does not include
evictions.
+     */
+    public long offHeapRemovals() {
+        return offHeapRemovals;
+    }
+
+    /**
+     * @return The total number of removals from the swap.
+     */
+    public long swapRemovals() {
+        return swapRemovals;
+    }
+
+    /**
      * @return The mean time to execute removes.
      */
     public float avgRemovalTime() {
@@ -345,6 +495,13 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
+     * @return The total number of evictions from the off-heap memory.
+     */
+    public long offHeapEvictions() {
+        return offHeapEvictions;
+    }
+
+    /**
      * @return Total number of transaction rollbacks.
      */
     public long txRollbacks() {
@@ -394,6 +551,27 @@ public class VisorCacheMetrics implements Serializable {
     }
 
     /**
+     * @return Number of primary entries stored in off-heap memory.
+     */
+    public long offHeapPrimarySize() {
+        return offHeapPrimarySize;
+    }
+
+    /**
+     * @return Number of backup entries stored in off-heap memory.
+     */
+    public long offHeapBackupSize() {
+        return offHeapBackupSize;
+    }
+
+    /**
+     * @return Size of swap.
+     */
+    public long swapSize() {
+        return swapSize;
+    }
+
+    /**
      * @return Gets number of keys in the cache, possibly with {@code null} values.
      */
     public int keySize() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/181cbe41/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
index 4c005af..804bd49 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheCommand.scala
@@ -402,10 +402,10 @@ class VisorCacheCommand {
                             X.timeSpan2HMSM(nm.getUpTime),
                             cm.keySize(),
                             (
-                                "Hi: " + cm.hits(),
-                                "Mi: " + cm.misses(),
-                                "Rd: " + cm.reads(),
-                                "Wr: " + cm.writes()
+                                "Hi: " + cm.hits() + cm.offHeapHits() + cm.swapHits(),
+                                "Mi: " + cm.misses() + cm.offHeapMisses() + cm.swapMisses(),
+                                "Rd: " + cm.reads() + cm.offHeapReads() + cm.swapReads(),
+                                "Wr: " + cm.writes() + cm.offHeapWrites() + cm.swapWrites()
                             )
                         )
                     }
@@ -551,10 +551,10 @@ class VisorCacheCommand {
         assert(arg != null)
 
         val sorted = arg.trim match {
-            case "hi" => data.toSeq.sortBy(_._2.hits)
-            case "mi" => data.toSeq.sortBy(_._2.misses)
-            case "rd" => data.toSeq.sortBy(_._2.reads)
-            case "wr" => data.toSeq.sortBy(_._2.writes)
+            case "hi" => data.toSeq.sortBy({ case (_, m) => m.hits() + m.offHeapHits()
+ m.swapHits() })
+            case "mi" => data.toSeq.sortBy({ case (_, m) => m.misses() + m.offHeapMisses()
+ m.swapMisses() })
+            case "rd" => data.toSeq.sortBy({ case (_, m) => m.reads() + m.offHeapReads()
+ m.swapReads() })
+            case "wr" => data.toSeq.sortBy({ case (_, m) => m.writes() + m.offHeapWrites()
+ m.swapWrites() })
             case "cn" => data.toSeq.sortBy(_._1)
 
             case _ =>


Mime
View raw message