Make GCInspector min log duration configurable

Patch by jjirsa; reviewed by jmckenzie for CASSANDRA-11715
This commit is contained in:
Jeff Jirsa 2016-07-11 16:27:04 -04:00 committed by Josh McKenzie
parent 9a8406f2f7
commit f0d1d75ebf
4 changed files with 19 additions and 3 deletions

View File

@ -858,9 +858,14 @@ inter_dc_tcp_nodelay: false
tracetype_query_ttl: 86400
tracetype_repair_ttl: 604800
# GC Pauses greater than gc_warn_threshold_in_ms will be logged at WARN level
# Adjust the threshold based on your application throughput requirement
# 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
# gc_warn_threshold_in_ms: 1000
# UDFs (user defined functions) are disabled by default.

View File

@ -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)

View File

@ -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;

View File

@ -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;