cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject svn commit: r988348 - in /cassandra/trunk: conf/cassandra-env.sh 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/CompactionManager.java
Date Mon, 23 Aug 2010 22:58:52 GMT
Author: brandonwilliams
Date: Mon Aug 23 22:58:51 2010
New Revision: 988348

URL: http://svn.apache.org/viewvc?rev=988348&view=rev
Log:
Expose compaction thread priority in yaml, make default MIN_PRIORITY, add needed JVM opts.
 Patch by brandonwilliams, reviewed by jbellis for CASSANDRA-1181

Modified:
    cassandra/trunk/conf/cassandra-env.sh
    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/CompactionManager.java

Modified: cassandra/trunk/conf/cassandra-env.sh
URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/cassandra-env.sh?rev=988348&r1=988347&r2=988348&view=diff
==============================================================================
--- cassandra/trunk/conf/cassandra-env.sh (original)
+++ cassandra/trunk/conf/cassandra-env.sh Mon Aug 23 22:58:51 2010
@@ -50,6 +50,8 @@ JVM_OPTS="$JVM_OPTS -XX:+CMSParallelRema
 JVM_OPTS="$JVM_OPTS -XX:SurvivorRatio=8" 
 JVM_OPTS="$JVM_OPTS -XX:MaxTenuringThreshold=1" 
 JVM_OPTS="$JVM_OPTS -XX:+HeapDumpOnOutOfMemoryError" 
+JVM_OPTS="$JVM_OPTS -XX:+UseThreadPriorities"
+JVM_OPTS="$JVM_OPTS -XX:ThreadPriorityPolicy=42"
 
 JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT" 
 JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false" 

Modified: cassandra/trunk/conf/cassandra.yaml
URL: http://svn.apache.org/viewvc/cassandra/trunk/conf/cassandra.yaml?rev=988348&r1=988347&r2=988348&view=diff
==============================================================================
--- cassandra/trunk/conf/cassandra.yaml (original)
+++ cassandra/trunk/conf/cassandra.yaml Mon Aug 23 22:58:51 2010
@@ -89,6 +89,10 @@ thrift_max_message_length_in_mb: 16
 
 snapshot_before_compaction: false
 
+# change this to increase the compaction thread's priority.  In java, 1 is the
+# lowest priority and that is our default.
+# compaction_thread_priority: 1
+
 # The threshold size in megabytes the binary memtable must grow to,
 # before it's submitted for flushing to disk.
 binary_memtable_throughput_in_mb: 256

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=988348&r1=988347&r2=988348&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/Config.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/Config.java Mon Aug 23 22:58:51 2010
@@ -66,6 +66,7 @@ public class Config
     public Integer thrift_max_message_length_in_mb = 16;
     public Integer thrift_framed_transport_size_in_mb = 15;
     public Boolean snapshot_before_compaction = false;
+    public Integer compaction_thread_priority = Thread.MIN_PRIORITY;
     
     public Integer binary_memtable_throughput_in_mb = 256;
     /* Number of minutes to keep a memtable in memory */

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=988348&r1=988347&r2=988348&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/config/DatabaseDescriptor.java Mon Aug 23
22:58:51 2010
@@ -263,6 +263,12 @@ public class DatabaseDescriptor
             {
                 throw new ConfigurationException("thrift_max_message_length_in_mb must be
greater than thrift_framed_transport_size_in_mb when using TFramedTransport");
             }
+
+            /* compaction thread priority */
+            if (conf.compaction_thread_priority < Thread.MIN_PRIORITY || conf.compaction_thread_priority
> Thread.NORM_PRIORITY)
+            {
+                throw new ConfigurationException("compaction_thread_priority must be between
1 and 5");
+            }
             
             /* end point snitch */
             if (conf.endpoint_snitch == null)
@@ -1120,6 +1126,11 @@ public class DatabaseDescriptor
         return conf.binary_memtable_throughput_in_mb;
     }
 
+    public static int getCompactionThreadPriority()
+    {
+        return conf.compaction_thread_priority;
+    }
+
     public static boolean isSnapshotBeforeCompaction()
     {
         return conf.snapshot_before_compaction;

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java?rev=988348&r1=988347&r2=988348&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/CompactionManager.java Mon Aug 23 22:58:51
2010
@@ -642,9 +642,7 @@ public class CompactionManager implement
 
         public CompactionExecutor()
         {
-            super("CompactionExecutor", System.getProperty("cassandra.compaction.priority")
== null
-                                        ? Thread.NORM_PRIORITY
-                                        : Integer.parseInt(System.getProperty("cassandra.compaction.priority")));
+            super("CompactionExecutor", DatabaseDescriptor.getCompactionThreadPriority());
         }
 
         @Override



Mime
View raw message