cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1024047 - in /cassandra/trunk: CHANGES.txt src/java/org/apache/cassandra/db/ColumnFamilyStore.java src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
Date Mon, 18 Oct 2010 22:28:31 GMT
Author: jbellis
Date: Mon Oct 18 22:28:30 2010
New Revision: 1024047

URL: http://svn.apache.org/viewvc?rev=1024047&view=rev
Log:
add jmx histogram of sstables accessed per read.
patch by Stu Hood; reviewed by jbellis for CASSANDRA-1624

Modified:
    cassandra/trunk/CHANGES.txt
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java

Modified: cassandra/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/trunk/CHANGES.txt?rev=1024047&r1=1024046&r2=1024047&view=diff
==============================================================================
--- cassandra/trunk/CHANGES.txt (original)
+++ cassandra/trunk/CHANGES.txt Mon Oct 18 22:28:30 2010
@@ -44,6 +44,7 @@ dev
  * fix building SSTable statistics post-stream (CASSANDRA-1620)
  * fix potential infinite loop in 2ary index queries (CASSANDRA-1623)
  * allow creating NTS keyspaces with no replicas configured (CASSANDRA-1626)
+ * add jmx histogram of sstables accessed per read (CASSANDRA-1624)
 
 
 0.7-beta2

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=1024047&r1=1024046&r2=1024047&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Mon Oct 18 22:28:30
2010
@@ -56,6 +56,7 @@ import org.apache.cassandra.service.Stor
 import org.apache.cassandra.thrift.IndexClause;
 import org.apache.cassandra.thrift.IndexExpression;
 import org.apache.cassandra.thrift.IndexOperator;
+import org.apache.cassandra.utils.EstimatedHistogram;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.LatencyTracker;
 import org.apache.cassandra.utils.Pair;
@@ -127,6 +128,10 @@ public class ColumnFamilyStore implement
     private LatencyTracker readStats = new LatencyTracker();
     private LatencyTracker writeStats = new LatencyTracker();
 
+    // counts of sstables accessed by reads
+    private final EstimatedHistogram recentSSTablesPerRead = new EstimatedHistogram(35);
+    private final EstimatedHistogram sstablesPerRead = new EstimatedHistogram(35);
+
     public final CFMetaData metadata;
 
     /* These are locally held copies to be changed from the config during runtime */
@@ -914,6 +919,16 @@ public class ColumnFamilyStore implement
         return ssTables.getSSTables();
     }
 
+    public long[] getRecentSSTablesPerReadHistogram()
+    {
+        return recentSSTablesPerRead.get(true);
+    }
+
+    public long[] getSSTablesPerReadHistogram()
+    {
+        return sstablesPerRead.get(false);
+    }
+
     public long getReadCount()
     {
         return readStats.getOpCount();
@@ -1115,6 +1130,7 @@ public class ColumnFamilyStore implement
             }
 
             /* add the SSTables on disk */
+            int sstablesToIterate = 0;
             for (SSTableReader sstable : ssTables)
             {
                 iter = filter.getSSTableColumnIterator(sstable);
@@ -1122,8 +1138,11 @@ public class ColumnFamilyStore implement
                 {
                     returnCF.delete(iter.getColumnFamily());
                     iterators.add(iter);
+                    sstablesToIterate++;
                 }
             }
+            recentSSTablesPerRead.add(sstablesToIterate);
+            sstablesPerRead.add(sstablesToIterate);
 
             Comparator<IColumn> comparator = filter.filter.getColumnComparator(getComparator());
             Iterator collated = IteratorUtils.collatedIterator(comparator, iterators);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java?rev=1024047&r1=1024046&r2=1024047&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStoreMBean.java Mon Oct 18
22:28:30 2010
@@ -62,6 +62,16 @@ public interface ColumnFamilyStoreMBean
     public Object forceFlush() throws IOException;
 
     /**
+     * @return a histogram of the number of sstable data files accessed per read: reading
this property resets it
+     */
+    public long[] getRecentSSTablesPerReadHistogram();
+
+    /**
+     * @return a histogram of the number of sstable data files accessed per read
+     */
+    public long[] getSSTablesPerReadHistogram();
+
+    /**
      * @return the number of read operations on this column family
      */
     public long getReadCount();



Mime
View raw message