Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Added config toggle for verbose GC logging #3663

Merged
merged 17 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 14 additions & 30 deletions heron/executor/src/python/heron_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
@click.option("--topology-defn-file", required=True)
@click.option("--topology-id", required=True)
@click.option("--topology-name", required=True)
@click.option("--enable-verbose-gc-log", required=False)
nicknezis marked this conversation as resolved.
Show resolved Hide resolved
@click.option("--jvm-remote-debugger-ports",
help="comma separated list of ports to be used"
" by a remote debugger for JVM instances")
Expand Down Expand Up @@ -342,6 +343,8 @@ def init_from_parsed_args(self, parsed_args):
self.health_manager_mode = parsed_args.health_manager_mode
self.health_manager_classpath = '%s:%s'\
% (self.scheduler_classpath, parsed_args.health_manager_classpath)
self.enable_verbose_gc_log = parsed_args.enable_verbose_gc_log \
nicknezis marked this conversation as resolved.
Show resolved Hide resolved
if parsed_args.enable_verbose_gc_log else 'false'
self.jvm_remote_debugger_ports = \
parsed_args.jvm_remote_debugger_ports.split(",") \
if parsed_args.jvm_remote_debugger_ports else None
Expand Down Expand Up @@ -574,36 +577,17 @@ def _get_java_major_version(self):
return int(self._get_jvm_version().split(".")[0])

def _get_java_gc_instance_cmd(self, cmd, gc_name):
gc_cmd = ['-verbosegc']
if self._get_java_major_version() >= 9:
gc_cmd += [
'-XX:+UseG1GC',
'-XX:+ParallelRefProcEnabled',
'-XX:+UseStringDeduplication',
'-XX:MaxGCPauseMillis=100',
'-XX:InitiatingHeapOccupancyPercent=30',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:ParallelGCThreads=4',
'-Xlog:gc*,safepoint=info:file=' + self.log_dir + '/gc.' + gc_name +
'.log:tags,time,uptime,level:filecount=5,filesize=100M']
else:
gc_cmd += [
'-XX:+UseConcMarkSweepGC',
'-XX:+CMSScavengeBeforeRemark',
'-XX:TargetSurvivorRatio=90',
'-XX:+PrintGCDetails',
'-XX:+PrintGCTimeStamps',
'-XX:+PrintGCDateStamps',
'-XX:+PrintGCCause',
'-XX:+UseGCLogFileRotation',
'-XX:NumberOfGCLogFiles=5',
'-XX:GCLogFileSize=100M',
'-XX:+PrintPromotionFailure',
'-XX:+PrintTenuringDistribution',
'-XX:+PrintHeapAtGC',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:ParallelGCThreads=4',
'-Xloggc:' + self.log_dir + '/gc.' + gc_name + '.log']
gc_cmd += [
nicknezis marked this conversation as resolved.
Show resolved Hide resolved
'-XX:+UseG1GC',
'-XX:+ParallelRefProcEnabled',
'-XX:+UseStringDeduplication',
'-XX:MaxGCPauseMillis=100',
'-XX:InitiatingHeapOccupancyPercent=30',
'-XX:+HeapDumpOnOutOfMemoryError',
'-XX:ParallelGCThreads=4']
if self.enable_verbose_gc_log:
nicknezis marked this conversation as resolved.
Show resolved Hide resolved
gc_cmd += ['-Xlog:gc*,safepoint=info:file=' + self.log_dir + '/gc.' + gc_name +
'.log:tags,time,uptime,level:filecount=5,filesize=100M']
try:
cp_index = cmd.index('-cp')
return list(itertools.chain(*[cmd[0:cp_index], gc_cmd, cmd[cp_index:]]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public enum ExecutorFlag {
StatefulConfigFile("stateful-config-file"),
HealthManagerMode("health-manager-mode"),
HealthManagerClasspath("health-manager-classpath"),
EnableVerboseGCLog("enable-verbose-gc-log"),
JvmRemoteDebuggerPorts("jvm-remote-debugger-ports");

private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ public static void addExecutorTopologyArgs(List<String> args, Config config, Con
args.add(createCommandArg(ExecutorFlag.TopologyBinaryFile,
Context.topologyBinaryFile(config)));
args.add(createCommandArg(ExecutorFlag.HeronJavaHome, Context.clusterJavaHome(config)));
args.add(createCommandArg(ExecutorFlag.EnableVerboseGCLog, Context.enableVerboseGCLog(config)));
args.add(createCommandArg(ExecutorFlag.HeronShellBinary, Context.shellBinary(config)));
args.add(createCommandArg(ExecutorFlag.Cluster, Context.cluster(config)));
args.add(createCommandArg(ExecutorFlag.Role, Context.role(config)));
Expand Down
3 changes: 3 additions & 0 deletions heron/spi/src/java/org/apache/heron/spi/common/Key.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ public enum Key {
HERON_CLUSTER_CONF ("heron.directory.cluster.conf", "./heron-conf"),
// TODO: rename below to heron.directory.cluster.java.home, coordinate change with twitter configs
HERON_CLUSTER_JAVA_HOME("heron.directory.sandbox.java.home", "/usr/lib/jvm/default-java"),

// Used to enable verbose JVM GC logging
ENABLE_VERBOSE_GC_LOG("heron.config.enable.verbose.gc.log", false),

//keys for heron configuration files on the cluster
OVERRIDE_YAML("heron.config.file.override.yaml", "${HERON_CONF}/override.yaml"),
Expand Down