You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2010/06/01 01:52:12 UTC

svn commit: r949904 - in /cassandra/trunk: conf/cassandra.yaml src/java/org/apache/cassandra/config/Config.java src/java/org/apache/cassandra/config/DatabaseDescriptor.java src/java/org/apache/cassandra/db/ColumnFamilyStore.java

Author: jbellis
Date: Mon May 31 23:52:12 2010
New Revision: 949904

URL: http://svn.apache.org/viewvc?rev=949904&view=rev
Log:
make CFS.flushWriter_ size configurable.  patch by Brandon Williams; reviewed by jbellis for CASSANDRA-1099

Modified:
    cassandra/trunk/conf/cassandra.yaml
    cassandra/trunk/src/java/org/apache/cassandra/config/Config.java
    cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java

Modified: cassandra/trunk/conf/cassandra.yaml
URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/cassandra.yaml?rev=949904&r1=949903&r2=949904&view=diff
==============================================================================
--- cassandra/trunk/conf/cassandra.yaml (original)
+++ cassandra/trunk/conf/cassandra.yaml Mon May 31 23:52:12 2010
@@ -51,6 +51,13 @@ disk_access_mode: auto
 concurrent_reads: 8
 concurrent_writes: 32
 
+# This sets the amount of memtable flush writer threads.  These will
+# be blocked by disk io, and each one will hold a memtable in memory
+# while blocked. If you have a large heap and many data directories,
+# you can increase this value for better flush performance.
+# By default this will be set to the amount of data directories defined.
+#memtable_flush_writers: 1
+
 # Buffer size to use when performing contiguous column slices. 
 # Increase this to the size of the column slices you typically perform
 sliced_buffer_size_in_kb: 64

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/Config.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/Config.java?rev=949904&r1=949903&r2=949904&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/Config.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/Config.java Mon May 31 23:52:12 2010
@@ -34,6 +34,7 @@ public class Config {
     public Integer concurrent_reads = 8;
     public Integer concurrent_writes = 32;
     
+    public Integer memtable_flush_writers = null; // will get set to the length of data dirs in DatabaseDescriptor
     
     public Double flush_data_buffer_size_in_mb = new Double(32);
     public Double flush_index_buffer_size_in_mb = new Double(8);

Modified: cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=949904&r1=949903&r2=949904&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Mon May 31 23:52:12 2010
@@ -218,7 +218,17 @@ public class DatabaseDescriptor
             {
                 throw new ConfigurationException("concurrent_writes must be at least 2");
             }
-            
+
+            /* Memtable flush writer threads */
+            if (conf.memtable_flush_writers != null && conf.memtable_flush_writers < 1)
+            {
+                throw new ConfigurationException("memtable_flush_writers must be at least 1");
+            }
+            else if (conf.memtable_flush_writers == null)
+            {
+                conf.memtable_flush_writers = conf.data_file_directories.length;
+            }
+
             /* Local IP or hostname to bind services to */
             if (conf.listen_address != null)
             {
@@ -780,6 +790,11 @@ public class DatabaseDescriptor
         return conf.concurrent_writes;
     }
 
+    public static int getFlushWriters()
+    {
+            return conf.memtable_flush_writers;
+    }
+
     public static long getRowWarningThreshold()
     {
         return conf.row_warning_threshold_in_mb * 1024 * 1024;

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=949904&r1=949903&r2=949904&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Mon May 31 23:52:12 2010
@@ -87,10 +87,10 @@ public class ColumnFamilyStore implement
                                                new NamedThreadFactory("FLUSH-SORTER-POOL"));
     private static ExecutorService flushWriter_
             = new JMXEnabledThreadPoolExecutor(1,
-                                               DatabaseDescriptor.getAllDataFileLocations().length,
+                                               DatabaseDescriptor.getFlushWriters(),
                                                StageManager.KEEPALIVE,
                                                TimeUnit.SECONDS,
-                                               new LinkedBlockingQueue<Runnable>(DatabaseDescriptor.getAllDataFileLocations().length),
+                                               new LinkedBlockingQueue<Runnable>(DatabaseDescriptor.getFlushWriters()),
                                                new NamedThreadFactory("FLUSH-WRITER-POOL"));
     private static ExecutorService commitLogUpdater_ = new JMXEnabledThreadPoolExecutor("MEMTABLE-POST-FLUSHER");