[
https://issues.apache.org/jira/browse/BEAM-7820?focusedWorklogId=290905&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-290905
]
ASF GitHub Bot logged work on BEAM-7820:
----------------------------------------
Author: ASF GitHub Bot
Created on: 08/Aug/19 00:50
Start Date: 08/Aug/19 00:50
Worklog Time Spent: 10m
Work Description: pabloem commented on pull request #9270: [BEAM-7820]
HotKeyDetection
URL: https://github.com/apache/beam/pull/9270#discussion_r311817803
##########
File path:
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/HotKeyLogger.java
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.dataflow.worker;
+
+import com.google.api.client.util.Clock;
+import java.text.MessageFormat;
+import org.apache.beam.runners.dataflow.util.TimeUtil;
+import org.joda.time.Duration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HotKeyLogger {
+ Logger LOG = LoggerFactory.getLogger(HotKeyLogger.class);
+
+ /** Clock used to either provide real system time or mocked to virtualize
time for testing. */
+ private Clock clock = Clock.SYSTEM;
+
+ /**
+ * The previous time the HotKeyDetection was logged. This is used to
throttle logging to every 5
+ * minutes.
+ */
+ private long prevHotKeyDetectionLogMs = 0;
+
+ /** Throttles logging the detection to every loggingPeriod */
+ private final Duration loggingPeriod = Duration.standardMinutes(5);
+
+ HotKeyLogger() {}
+
+ HotKeyLogger(Clock clock) {
+ this.clock = clock;
+ }
+
+ /** Logs a detection of the hot key every 5 minutes. */
+ public void logHotKeyDetection(String userStepName, Duration hotKeyAge) {
+ if (isThrottled()) {
+ return;
+ }
+ LOG.warn(getHotKeyMessage(userStepName,
TimeUtil.toCloudDuration(hotKeyAge)));
Review comment:
Is warning the right log level for this? It may be "normal", and acceptable
to have a hot key - and when users see a warning they'll think something bad is
happening. What do you think?
The same thing has happened with lull logging, where users think something's
wrong - though that's not the case.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 290905)
Time Spent: 2h 50m (was: 2h 40m)
> Add hot key detection to Dataflow Runner
> ----------------------------------------
>
> Key: BEAM-7820
> URL: https://issues.apache.org/jira/browse/BEAM-7820
> Project: Beam
> Issue Type: New Feature
> Components: runner-dataflow
> Reporter: Sam Rohde
> Assignee: Sam Rohde
> Priority: Minor
> Time Spent: 2h 50m
> Remaining Estimate: 0h
>
> This tracks adding hot key detection in the Dataflow Runner.
> There are times when a user's pipeline spuriously slows down due to hot keys.
> During these times, users are unable to see under the hood at what the
> pipeline is doing. This adds hot key detection to show the user when their
> pipeline has a hot key.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)