cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [04/10] cassandra git commit: Make GCInspector min log duration configurable
Date Mon, 11 Jul 2016 20:45:31 GMT
Make GCInspector min log duration configurable

Patch by jjirsa; reviewed by jmckenzie for CASSANDRA-11715


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f0d1d75e
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f0d1d75e
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f0d1d75e

Branch: refs/heads/trunk
Commit: f0d1d75ebf10beff6d24323c03c57e29dcd38c15
Parents: 9a8406f
Author: Jeff Jirsa <jeff@jeffjirsa.net>
Authored: Mon Jul 11 16:27:04 2016 -0400
Committer: Josh McKenzie <jmckenzie@apache.org>
Committed: Mon Jul 11 16:27:04 2016 -0400

----------------------------------------------------------------------
 conf/cassandra.yaml                                       |  7 ++++++-
 src/java/org/apache/cassandra/config/Config.java          |  1 +
 .../org/apache/cassandra/config/DatabaseDescriptor.java   | 10 ++++++++++
 src/java/org/apache/cassandra/service/GCInspector.java    |  2 +-
 4 files changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0d1d75e/conf/cassandra.yaml
----------------------------------------------------------------------
diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml
index 35e94d2..4ad798a 100644
--- a/conf/cassandra.yaml
+++ b/conf/cassandra.yaml
@@ -858,9 +858,14 @@ inter_dc_tcp_nodelay: false
 tracetype_query_ttl: 86400
 tracetype_repair_ttl: 604800
 
+# By default, Cassandra logs GC Pauses greater than 200 ms at INFO level
+# This threshold can be adjusted to minimize logging if necessary
+# gc_log_threshold_in_ms: 200
+
 # GC Pauses greater than gc_warn_threshold_in_ms will be logged at WARN level
+# If unset, all GC Pauses greater than gc_log_threshold_in_ms will log at
+# INFO level
 # Adjust the threshold based on your application throughput requirement
-# By default, Cassandra logs GC Pauses greater than 200 ms at INFO level
 # gc_warn_threshold_in_ms: 1000
 
 # UDFs (user defined functions) are disabled by default.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0d1d75e/src/java/org/apache/cassandra/config/Config.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index 9736a03..ede4560 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -254,6 +254,7 @@ public class Config
     public volatile Long index_summary_capacity_in_mb;
     public volatile int index_summary_resize_interval_in_minutes = 60;
 
+    public int gc_log_threshold_in_ms = 200;
     public int gc_warn_threshold_in_ms = 0;
 
     private static final CsvPreference STANDARD_SURROUNDING_SPACES_NEED_QUOTES = new CsvPreference.Builder(CsvPreference.STANDARD_PREFERENCE)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0d1d75e/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index d3a5028..f1acfc4 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -366,6 +366,11 @@ public class DatabaseDescriptor
         }
         paritionerName = partitioner.getClass().getCanonicalName();
 
+        if (config.gc_log_threshold_in_ms < 0)
+        {
+            throw new ConfigurationException("gc_log_threshold_in_ms must be a positive integer");
+        }
+
         if (conf.gc_warn_threshold_in_ms < 0)
         {
             throw new ConfigurationException("gc_warn_threshold_in_ms must be a positive
integer");
@@ -1801,6 +1806,11 @@ public class DatabaseDescriptor
         return conf.windows_timer_interval;
     }
 
+    public static long getGCLogThreshold()
+    {
+        return conf.gc_log_threshold_in_ms;
+    }
+
     public static long getGCWarnThreshold()
     {
         return conf.gc_warn_threshold_in_ms;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f0d1d75e/src/java/org/apache/cassandra/service/GCInspector.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/GCInspector.java b/src/java/org/apache/cassandra/service/GCInspector.java
index de5acc0..31de151 100644
--- a/src/java/org/apache/cassandra/service/GCInspector.java
+++ b/src/java/org/apache/cassandra/service/GCInspector.java
@@ -48,7 +48,7 @@ public class GCInspector implements NotificationListener, GCInspectorMXBean
 {
     public static final String MBEAN_NAME = "org.apache.cassandra.service:type=GCInspector";
     private static final Logger logger = LoggerFactory.getLogger(GCInspector.class);
-    final static long MIN_LOG_DURATION = 200;
+    final static long MIN_LOG_DURATION = DatabaseDescriptor.getGCLogThreshold();
     final static long GC_WARN_THRESHOLD_IN_MS = DatabaseDescriptor.getGCWarnThreshold();
     final static long STAT_THRESHOLD = GC_WARN_THRESHOLD_IN_MS != 0 ? GC_WARN_THRESHOLD_IN_MS
: MIN_LOG_DURATION;
 


Mime
View raw message