tillrohrmann commented on a change in pull request #12264:
URL: https://github.com/apache/flink/pull/12264#discussion_r430381100



##########
File path: 
flink-core/src/main/java/org/apache/flink/configuration/TaskManagerOptions.java
##########
@@ -490,6 +490,13 @@
                                + " size will be used. The exact size of JVM 
Overhead can be explicitly specified by setting the min/max"
                                + " size to the same value.");
 
+       @Documentation.ExcludeFromDocumentation("This option just serves as a 
last-ditch escape hatch.")
+       public static final ConfigOption<Integer> NUM_IO_THREADS =
+               key("taskmanager.io.threads.num")
+                       .intType()
+                       .defaultValue(2)
+                       .withDescription("The number of threads to use for 
non-critical IO operations.");

Review comment:
       The `HighAvailabilityServices` use the `ioExecutor` for I/O tasks. 
Concretely, they use it do dispose a completed checkpoint. In that sense it is 
also an I/O operation and I think they could be served by the same executor. 
But in order to keep the scope smaller, we don't have to do it in this PR.

##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskManagerServices.java
##########
@@ -265,10 +265,15 @@ public static TaskManagerServices fromConfiguration(
                // start the I/O manager, it will create some temp directories.
                final IOManager ioManager = new 
IOManagerAsync(taskManagerServicesConfiguration.getTmpDirPaths());
 
+               final ExecutorService ioExecutor = Executors.newFixedThreadPool(

Review comment:
       I think we should really unify them. `taskIOExecutor` is effectively the 
same as `ioExecutor` because it is used by the 
`TaskExecutorLocalStateStoresManager` for discarding local state. I think it is 
better to use common thread pools until we have a really good reason for 
separating thread pools. Creating more thread pools will also increase the 
required resource foot print.
   
   Concerning the number of threads, I would suggest to use 
`ClusterOptions.CLUSTER_IO_EXECUTOR_POOL_SIZE` which defaults to the number of 
available cores if it has not been specified. This will also allow users to 
increase the thread pool if things take too long with a single thread.

##########
File path: 
flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/executor/TestExecutorServiceResource.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.testutils.executor;
+
+import org.junit.rules.ExternalResource;
+
+import java.util.concurrent.ExecutorService;
+import java.util.function.Supplier;
+
+/**
+ * Resource which starts an {@link ExecutorService} for testing purposes.
+ */
+public class TestExecutorServiceResource extends ExternalResource {
+
+       private final Supplier<ExecutorService> serviceFactory;
+
+       private ExecutorService executorService;
+
+       public TestExecutorServiceResource(Supplier<ExecutorService> 
serviceFactory) {
+               this.serviceFactory = serviceFactory;
+       }
+
+       @Override
+       protected void before() throws Throwable {
+               executorService = serviceFactory.get();
+       }
+
+       public ExecutorService getExecutorService() {
+               return executorService;
+       }
+
+       @Override
+       protected void after() {
+               if (executorService != null) {
+                       executorService.shutdown();

Review comment:
       I would suggest to use `ExecutorUtils.gracefulShutdown`.

##########
File path: 
flink-test-utils-parent/flink-test-utils-junit/src/main/java/org/apache/flink/testutils/executor/TestExecutorServiceResource.java
##########
@@ -0,0 +1,53 @@
+/*
+ * 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.testutils.executor;
+
+import org.junit.rules.ExternalResource;
+
+import java.util.concurrent.ExecutorService;
+import java.util.function.Supplier;
+
+/**
+ * Resource which starts an {@link ExecutorService} for testing purposes.
+ */
+public class TestExecutorServiceResource extends ExternalResource {

Review comment:
       This class seems to duplicate `TestingScheduledExecutor`.




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


Reply via email to