flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] zhijiangW commented on a change in pull request #10083: [FLINK-14472][runtime]Implement back-pressure monitor with non-blocking outputs.
Date Fri, 08 Nov 2019 06:36:12 GMT
zhijiangW commented on a change in pull request #10083: [FLINK-14472][runtime]Implement back-pressure
monitor with non-blocking outputs.
URL: https://github.com/apache/flink/pull/10083#discussion_r344005130
 
 

 ##########
 File path: flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/BackPressureSampleService.java
 ##########
 @@ -0,0 +1,116 @@
+/*
+ * 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.flink.runtime.taskexecutor;
+
+import org.apache.flink.api.common.time.Time;
+import org.apache.flink.runtime.concurrent.ScheduledExecutor;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+import static org.apache.flink.util.Preconditions.checkArgument;
+import static org.apache.flink.util.Preconditions.checkNotNull;
+
+/**
+ * Samples whether a task is back pressured multi times. The total number of samples
+ * divided by the number of back pressure samples reaches the back pressure ratio.
+ */
+public class BackPressureSampleService {
+
+	/** Number of samples to take when determining the back pressure of a task. */
+	private final int numSamples;
+
+	/** Time to wait between samples when determining the back pressure of a task. */
+	private final Time delayBetweenSamples;
+
+	/** Executor to run sample tasks. */
+	private final ScheduledExecutor scheduledExecutor;
+
+	BackPressureSampleService(
+			int numSamples,
+			Time delayBetweenSamples,
+			ScheduledExecutor scheduledExecutor) {
+
+		checkArgument(numSamples >= 1, "Illegal number of samples: " + numSamples);
+
+		this.numSamples = numSamples;
+		this.delayBetweenSamples = checkNotNull(delayBetweenSamples);
+		this.scheduledExecutor = checkNotNull(scheduledExecutor, "The scheduledExecutor must not
be null.");
+	}
+
+	/**
+	 * Returns a future that completes with the back pressure ratio of a task.
 
 Review comment:
   Schedules to sample the task back pressure and returns a future....

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message