[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16644818#comment-16644818 ] ASF GitHub Bot commented on FLINK-10282: zentol closed pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/docs/_includes/generated/rest_configuration.html b/docs/_includes/generated/rest_configuration.html index 25da9cfb067..1aa963fb3e2 100644 --- a/docs/_includes/generated/rest_configuration.html +++ b/docs/_includes/generated/rest_configuration.html @@ -57,5 +57,10 @@ 104857600 The maximum content length in bytes that the server will handle. + +rest.server.numThreads +4 +The number of threads for the asynchronous processing of requests. + diff --git a/flink-core/src/main/java/org/apache/flink/configuration/RestOptions.java b/flink-core/src/main/java/org/apache/flink/configuration/RestOptions.java index c834483d7d0..edfd39be808 100644 --- a/flink-core/src/main/java/org/apache/flink/configuration/RestOptions.java +++ b/flink-core/src/main/java/org/apache/flink/configuration/RestOptions.java @@ -117,4 +117,8 @@ .defaultValue(104_857_600) .withDescription("The maximum content length in bytes that the client will handle."); + public static final ConfigOption SERVER_NUM_THREADS = + key("rest.server.numThreads") + .defaultValue(4) + .withDescription("The number of threads for the asynchronous processing of requests."); } diff --git a/flink-docs/src/main/java/org/apache/flink/docs/rest/RestAPIDocGenerator.java b/flink-docs/src/main/java/org/apache/flink/docs/rest/RestAPIDocGenerator.java index 4df1d6ee71b..47a5725387e 100644 --- a/flink-docs/src/main/java/org/apache/flink/docs/rest/RestAPIDocGenerator.java +++ b/flink-docs/src/main/java/org/apache/flink/docs/rest/RestAPIDocGenerator.java @@ -22,7 +22,6 @@ import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.JobManagerOptions; import org.apache.flink.configuration.RestOptions; -import org.apache.flink.runtime.concurrent.Executors; import org.apache.flink.runtime.dispatcher.DispatcherGateway; import org.apache.flink.runtime.dispatcher.DispatcherRestEndpoint; import org.apache.flink.runtime.leaderelection.LeaderContender; @@ -69,7 +68,7 @@ import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Executor; +import java.util.concurrent.Executors; import java.util.stream.Collectors; import static org.apache.flink.docs.util.Utils.escapeCharacters; @@ -323,7 +322,6 @@ public SerializableString getEscapeSequence(int i) { private static final Configuration config; private static final RestServerEndpointConfiguration restConfig; private static final RestHandlerConfiguration handlerConfig; - private static final Executor executor; private static final GatewayRetriever dispatcherGatewayRetriever; private static final GatewayRetriever resourceManagerGatewayRetriever; private static final MetricQueryServiceRetriever metricQueryServiceRetriever; @@ -339,7 +337,6 @@ public SerializableString getEscapeSequence(int i) { throw new RuntimeException("Implementation error. RestServerEndpointConfiguration#fromConfiguration failed for default configuration."); } handlerConfig = RestHandlerConfiguration.fromConfiguration(config); - executor = Executors.directExecutor(); dispatcherGatewayRetriever = () -> null; resourceManagerGatewayRetriever = () -> null; @@ -354,7 +351,7 @@ private DocumentingDispatcherRestEndpoint() throws IOException { handlerConfig, resourceManagerGatewayRetriever, NoOpTransientBlobService.INSTANCE, - executor, + Executors.newFixedThreadPool(1), metricQueryServiceRetriever, NoOpElectionService.INSTANCE, NoOpFatalErrorHandler.INSTANCE); diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/DispatcherRestEndpoint.java
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16643042#comment-16643042 ] ASF GitHub Bot commented on FLINK-10282: zentol commented on a change in pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#discussion_r223622672 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ## @@ -341,7 +343,9 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + WebMonitorEndpoint.createExecutorService( + configuration.getInteger(RestOptions.SERVER_NUM_THREADS), + "DispatcherRestEndpoint"), Review comment: > almost \> proceeds to change every method :D We seem to disagree on what constitutes a Close**Ignoring** executor service, this looks like a run-of-the-mill `Executor` wrapper to me. The thread-pool size is now 1, unless it was explicitly configured. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16642998#comment-16642998 ] ASF GitHub Bot commented on FLINK-10282: tillrohrmann commented on a change in pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#discussion_r223613201 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ## @@ -341,7 +343,9 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + WebMonitorEndpoint.createExecutorService( + configuration.getInteger(RestOptions.SERVER_NUM_THREADS), + "DispatcherRestEndpoint"), Review comment: Yes that is the intention. Decreasing the size of the thread pool would also be a good option. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16642995#comment-16642995 ] ASF GitHub Bot commented on FLINK-10282: tillrohrmann commented on a change in pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#discussion_r223612401 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ## @@ -341,7 +343,9 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + WebMonitorEndpoint.createExecutorService( + configuration.getInteger(RestOptions.SERVER_NUM_THREADS), + "DispatcherRestEndpoint"), Review comment: Almost. I think it should have a field `terminationFuture`: ``` private static class CloseIgnoringExecutorService extends AbstractExecutorService { private final Executor executor; private final CompletableFuture terminationFuture = new CompletableFuture<>(); public CloseIgnoringExecutorService(Executor executor) { this.executor = executor; } @Override public void shutdown() { terminationFuture.complete(null); } @Override public List shutdownNow() { shutdown(); return Collections.emptyList(); } @Override public boolean isShutdown() { return terminationFuture.isDone(); } @Override public boolean isTerminated() { return terminationFuture.isDone(); } @Override public boolean awaitTermination(long timeout, TimeUnit unit) { try { terminationFuture.get(timeout, unit); return true; } catch (TimeoutException e) { return false; } } @Override public void execute(Runnable command) { if (terminationFuture.isDone()) { throw new RejectedExecutionException(); } else { executor.execute(command); } } } ``` This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16642993#comment-16642993 ] ASF GitHub Bot commented on FLINK-10282: tillrohrmann commented on a change in pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#discussion_r223612401 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ## @@ -341,7 +343,9 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + WebMonitorEndpoint.createExecutorService( + configuration.getInteger(RestOptions.SERVER_NUM_THREADS), + "DispatcherRestEndpoint"), Review comment: Almost. I think we should have a field `terminationFuture`: ``` private static class CloseIgnoringExecutorService extends AbstractExecutorService { private final Executor executor; private final CompletableFuture terminationFuture = new CompletableFuture<>(); public CloseIgnoringExecutorService(Executor executor) { this.executor = executor; } @Override public void shutdown() { terminationFuture.complete(null); } @Override public List shutdownNow() { shutdown(); return Collections.emptyList(); } @Override public boolean isShutdown() { return terminationFuture.isDone(); } @Override public boolean isTerminated() { return terminationFuture.isDone(); } @Override public boolean awaitTermination(long timeout, TimeUnit unit) { try { terminationFuture.get(timeout, unit); return true; } catch (TimeoutException e) { return false; } } @Override public void execute(Runnable command) { if (terminationFuture.isDone()) { throw new RejectedExecutionException(); } else { executor.execute(command); } } } ``` This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16642988#comment-16642988 ] ASF GitHub Bot commented on FLINK-10282: zentol commented on a change in pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#discussion_r223610445 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ## @@ -341,7 +343,9 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + WebMonitorEndpoint.createExecutorService( + configuration.getInteger(RestOptions.SERVER_NUM_THREADS), + "DispatcherRestEndpoint"), Review comment: Is this about making the MIniCluster more light-weight? If so, couldn't we also reduce the thread-pool size to 1 instead? Re-using another executor means that it will both differ in behavior and thread-debugging (different names) compared to production. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16642980#comment-16642980 ] ASF GitHub Bot commented on FLINK-10282: zentol commented on a change in pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#discussion_r223609034 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ## @@ -341,7 +343,9 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + WebMonitorEndpoint.createExecutorService( + configuration.getInteger(RestOptions.SERVER_NUM_THREADS), + "DispatcherRestEndpoint"), Review comment: Would the following be all that we need? ``` private static class CloseIgnoringExecutorService extends AbstractExecutorService { private final Executor executor; public CloseIgnoringExecutorService(Executor executor) { this.executor = executor; } @Override public void shutdown() { } @Override public List shutdownNow() { return Collections.emptyList(); } @Override public boolean isShutdown() { return false; } @Override public boolean isTerminated() { return false; } @Override public boolean awaitTermination(long timeout, TimeUnit unit) { return false; } @Override public void execute(Runnable command) { executor.execute(command); } } ``` This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16642981#comment-16642981 ] ASF GitHub Bot commented on FLINK-10282: zentol commented on a change in pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#discussion_r223609034 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ## @@ -341,7 +343,9 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + WebMonitorEndpoint.createExecutorService( + configuration.getInteger(RestOptions.SERVER_NUM_THREADS), + "DispatcherRestEndpoint"), Review comment: Would the following be all that we need? ``` private static class CloseIgnoringExecutorService extends AbstractExecutorService { private final Executor executor; public CloseIgnoringExecutorService(Executor executor) { this.executor = executor; } @Override public void shutdown() { } @Override public List shutdownNow() { return Collections.emptyList(); } @Override public boolean isShutdown() { return false; } @Override public boolean isTerminated() { return false; } @Override public boolean awaitTermination(long timeout, TimeUnit unit) { return false; } @Override public void execute(Runnable command) { executor.execute(command); } } ``` This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16642970#comment-16642970 ] ASF GitHub Bot commented on FLINK-10282: tillrohrmann commented on a change in pull request #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#discussion_r223605351 ## File path: flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java ## @@ -341,7 +343,9 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + WebMonitorEndpoint.createExecutorService( + configuration.getInteger(RestOptions.SERVER_NUM_THREADS), + "DispatcherRestEndpoint"), Review comment: In the `MiniCluster` case, it might be justifiable to use the `commonRpcService.getExecutor`. In particular, if it is configured to use a shared rpc service/`useSingleRpcService == true`. For this work, we would need a `CloseIgnoringExecutorService` which wraps an `Executor` and ignores the shutdown call. This can also be a follow up. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16641803#comment-16641803 ] ASF GitHub Bot commented on FLINK-10282: zentol commented on issue #6786: [FLINK-10282][rest] Separate REST and Dispatcher RPC thread pools URL: https://github.com/apache/flink/pull/6786#issuecomment-427820203 @tillrohrmann Could you take another look? ## Brief change log * reverted removal of Executor constructor argument, but changed type to ExecutorService * reverted chances to `RestServerEndpointConfiguration` * introduced a `Builder` for `ExecutorThreadFactory` * made thread-priority configurable in `ExecutorThreadFactory` * added ´WebMonitorEndpoint.createExecutorService` as a default factory This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16625586#comment-16625586 ] ASF GitHub Bot commented on FLINK-10282: zentol closed pull request #6661: FLINK-10282][runtime] Separate RPC and REST thread-pools URL: https://github.com/apache/flink/pull/6661 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java b/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java index ddd3751cc2a..3b784211eeb 100755 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java @@ -64,6 +64,7 @@ import org.apache.flink.runtime.security.SecurityConfiguration; import org.apache.flink.runtime.security.SecurityContext; import org.apache.flink.runtime.security.SecurityUtils; +import org.apache.flink.runtime.util.ExecutorThreadFactory; import org.apache.flink.runtime.util.ZooKeeperUtils; import org.apache.flink.runtime.webmonitor.WebMonitorEndpoint; import org.apache.flink.runtime.webmonitor.retriever.LeaderGatewayRetriever; @@ -91,6 +92,7 @@ import java.util.concurrent.Callable; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; import scala.concurrent.duration.FiniteDuration; @@ -328,7 +330,7 @@ protected void startClusterComponents( dispatcherGatewayRetriever, resourceManagerGatewayRetriever, transientBlobCache, - rpcService.getExecutor(), + Executors.newFixedThreadPool(8, new ExecutorThreadFactory("Flink-DispatcherRestEndpoint")), new AkkaQueryServiceRetriever(actorSystem, timeout), highAvailabilityServices.getWebMonitorLeaderElectionService()); diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java index 8054a383739..d948947b334 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/minicluster/MiniCluster.java @@ -70,6 +70,7 @@ import org.apache.flink.runtime.rpc.akka.AkkaRpcService; import org.apache.flink.runtime.taskexecutor.TaskExecutor; import org.apache.flink.runtime.taskexecutor.TaskManagerRunner; +import org.apache.flink.runtime.util.ExecutorThreadFactory; import org.apache.flink.runtime.webmonitor.retriever.impl.AkkaQueryServiceRetriever; import org.apache.flink.runtime.webmonitor.retriever.impl.RpcGatewayRetriever; import org.apache.flink.util.AutoCloseableAsync; @@ -95,6 +96,7 @@ import java.util.concurrent.CompletionException; import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; import java.util.stream.Collectors; import static org.apache.flink.util.Preconditions.checkNotNull; @@ -341,7 +343,7 @@ public void start() throws Exception { RestHandlerConfiguration.fromConfiguration(configuration), resourceManagerGatewayRetriever, blobServer.getTransientBlobService(), - commonRpcService.getExecutor(), + Executors.newFixedThreadPool(8, new ExecutorThreadFactory("Flink-DispatcherRestEndpoint")), new AkkaQueryServiceRetriever( actorSystem, Time.milliseconds(configuration.getLong(WebOptions.TIMEOUT))), This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime,
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16625585#comment-16625585 ] ASF GitHub Bot commented on FLINK-10282: zentol commented on issue #6661: FLINK-10282][runtime] Separate RPC and REST thread-pools URL: https://github.com/apache/flink/pull/6661#issuecomment-423923847 I'll close this disaster of a PR and open a new one later. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16623298#comment-16623298 ] ASF GitHub Bot commented on FLINK-10282: TisonKun commented on issue #6661: FLINK-10282][runtime] Separate RPC and REST thread-pools URL: https://github.com/apache/flink/pull/6661#issuecomment-423466269 Once introduce a new thread-pool to deal with REST tasks, we need to manage its lifecycle inside `WebMonitorEndpoint` instead of initial it at `ClusterEntrypoint`. To make it more clear, we should pass a argument that how much threads the thread-pool should contain instead of a `Executor`, and init `ExecutorService` in `WebMonitorEndpoint`. Also, when shutdown the endpoint, shutdown the service. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.7.0, 1.6.2, 1.5.5 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FLINK-10282) Provide separate thread-pool for REST endpoint
[ https://issues.apache.org/jira/browse/FLINK-10282?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16604213#comment-16604213 ] ASF GitHub Bot commented on FLINK-10282: zentol opened a new pull request #6661: FLINK-10282][runtime] Separate RPC and REST thread-pools URL: https://github.com/apache/flink/pull/6661 ## What is the purpose of the change With this PR the REST endpoints are given their own thread-pool and don't share it with the Dispatchers RPC system. ## Verifying this change This change is a trivial rework / code cleanup without any test coverage. This is an automated message from the Apache Git Service. To respond to the message, please log on 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 > Provide separate thread-pool for REST endpoint > -- > > Key: FLINK-10282 > URL: https://issues.apache.org/jira/browse/FLINK-10282 > Project: Flink > Issue Type: Improvement > Components: Local Runtime, REST >Affects Versions: 1.5.1, 1.6.0, 1.7.0 >Reporter: Chesnay Schepler >Assignee: Chesnay Schepler >Priority: Major > Labels: pull-request-available > Fix For: 1.6.1, 1.7.0, 1.5.4 > > > The REST endpoints currently share their thread-pools with the RPC system, > which can cause the Dispatcher to become unresponsive if the REST parts are > overloaded. -- This message was sent by Atlassian JIRA (v7.6.3#76005)