cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject svn commit: r1097887 - in /cassandra/branches/cassandra-0.8: ./ conf/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/
Date Fri, 29 Apr 2011 17:00:27 GMT
Author: slebresne
Date: Fri Apr 29 17:00:26 2011
New Revision: 1097887

URL: http://svn.apache.org/viewvc?rev=1097887&view=rev
Log:
Add option to configure number of compaction thread
patch by slebresne; reviewed by stuhood and jbellis for CASSANDRA-2558

Modified:
    cassandra/branches/cassandra-0.8/CHANGES.txt
    cassandra/branches/cassandra-0.8/conf/cassandra.yaml
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/Config.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CompactionManager.java

Modified: cassandra/branches/cassandra-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/CHANGES.txt?rev=1097887&r1=1097886&r2=1097887&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.8/CHANGES.txt Fri Apr 29 17:00:26 2011
@@ -16,6 +16,7 @@
    automatic compactions will only compact 2 or more sstables (CASSANDRA-2575)
  * refuse to apply migrations with older timestamps than the current 
    schema (CASSANDRA-2536)
+ * Allow configuring the number of compaction thread (CASSANDRA-2558)
 
 
 0.8.0-beta1

Modified: cassandra/branches/cassandra-0.8/conf/cassandra.yaml
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/conf/cassandra.yaml?rev=1097887&r1=1097886&r2=1097887&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/conf/cassandra.yaml (original)
+++ cassandra/branches/cassandra-0.8/conf/cassandra.yaml Fri Apr 29 17:00:26 2011
@@ -249,10 +249,15 @@ column_index_size_in_kb: 64
 # will be logged specifying the row key.
 in_memory_compaction_limit_in_mb: 64
 
-# Enables multiple compactions to execute at once. This is highly recommended
-# for preserving read performance in a mixed read/write workload as this
-# avoids sstables from accumulating during long running compactions.
-compaction_multithreading: false
+# Number of compaction threads. This default to the number of processors,
+# enabling multiple compactions to execute at once. Using more than one
+# thread is highly recommended to preserve read performance in a mixed
+# read/write workload as this avoids sstables from accumulating during long
+# running compactions. The default is usually fine and if you experience
+# problems with compaction running too slowly or too fast, you should look at
+# compaction_throughput_mb_per_sec first.
+# Uncomment to make compaction mono-threaded.
+#concurrent_compacters: 1
 
 # Throttles compaction to the given total throughput across the entire
 # system. The faster you insert data, the faster you need to compact in

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/Config.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/Config.java?rev=1097887&r1=1097886&r2=1097887&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/Config.java (original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/Config.java Fri
Apr 29 17:00:26 2011
@@ -82,7 +82,7 @@ public class Config
     /* if the size of columns or super-columns are more than this, indexing will kick in
*/
     public Integer column_index_size_in_kb = 64;
     public Integer in_memory_compaction_limit_in_mb = 256;
-    public Boolean compaction_multithreading = true;
+    public Integer concurrent_compactors = Runtime.getRuntime().availableProcessors();
     public Integer compaction_throughput_mb_per_sec = 16;
     
     public String[] data_file_directories;

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/DatabaseDescriptor.java?rev=1097887&r1=1097886&r2=1097887&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
Fri Apr 29 17:00:26 2011
@@ -341,8 +341,11 @@ public class DatabaseDescriptor
                 throw new ConfigurationException("in_memory_compaction_limit_in_mb must be
a positive integer");
             }
 
-            if (conf.compaction_multithreading == null)
-                conf.compaction_multithreading = true;
+            if (conf.concurrent_compactors == null)
+                conf.concurrent_compactors = Runtime.getRuntime().availableProcessors();
+
+            if (conf.concurrent_compactors <= 0)
+                throw new ConfigurationException("concurrent_compactors should be strictly
greater than 0");
 
             if (conf.compaction_throughput_mb_per_sec == null)
                 conf.compaction_throughput_mb_per_sec = 16;
@@ -729,9 +732,9 @@ public class DatabaseDescriptor
         return conf.in_memory_compaction_limit_in_mb * 1024 * 1024;
     }
 
-    public static boolean getCompactionMultithreading()
+    public static int getConcurrentCompactors()
     {
-        return conf.compaction_multithreading;
+        return conf.concurrent_compactors;
     }
 
     public static int getCompactionThroughputMbPerSec()

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CompactionManager.java?rev=1097887&r1=1097886&r2=1097887&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CompactionManager.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/db/CompactionManager.java
Fri Apr 29 17:00:26 2011
@@ -1217,9 +1217,7 @@ public class CompactionManager implement
 
         private static int getThreadCount()
         {
-            if (!DatabaseDescriptor.getCompactionMultithreading())
-                return 1;
-            return Math.max(2, Runtime.getRuntime().availableProcessors());
+            return Math.max(1, DatabaseDescriptor.getConcurrentCompactors());
         }
 
         void beginCompaction(CompactionInfo.Holder ci)



Mime
View raw message