From b750590a1d1c9ca09a46ff9f73a66c2cade13fc0 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Mon, 16 Oct 2023 16:52:29 +0800 Subject: [PATCH] optimize admin config and thread pool --- eventmesh-runtime/conf/eventmesh.properties | 24 +++++++++---------- .../runtime/boot/AbstractHTTPServer.java | 3 +-- .../runtime/boot/EventMeshHTTPServer.java | 4 ++-- .../runtime/boot/HTTPThreadPoolGroup.java | 16 ++++++------- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/eventmesh-runtime/conf/eventmesh.properties b/eventmesh-runtime/conf/eventmesh.properties index 057688ede0..de4150fbad 100644 --- a/eventmesh-runtime/conf/eventmesh.properties +++ b/eventmesh-runtime/conf/eventmesh.properties @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -###############################EVNETMESH-runtime ENV################################# +########################## EventMesh Runtime Environment ########################## eventMesh.server.idc=DEFAULT eventMesh.server.env=PRD eventMesh.server.provide.protocols=HTTP,TCP,GRPC @@ -23,7 +23,7 @@ eventMesh.server.name=EVENTMESH-runtime eventMesh.sysid=0000 eventMesh.server.http.port=10105 eventMesh.server.grpc.port=10205 -########################## eventMesh tcp configuration ############################ +########################## EventMesh TCP Configuration ########################## eventMesh.server.tcp.enabled=true eventMesh.server.tcp.port=10000 eventMesh.server.tcp.readerIdleSeconds=120 @@ -49,41 +49,41 @@ eventMesh.server.maxEventBatchSize=10 # thread number about global scheduler eventMesh.server.global.scheduler=5 eventMesh.server.tcp.taskHandleExecutorPoolSize=8 -#retry +# retry eventMesh.server.retry.async.pushRetryTimes=3 eventMesh.server.retry.sync.pushRetryTimes=3 eventMesh.server.retry.async.pushRetryDelayInMills=500 eventMesh.server.retry.sync.pushRetryDelayInMills=500 eventMesh.server.retry.pushRetryQueueSize=10000 -#admin +# runtime admin eventMesh.server.admin.http.port=10106 -#metaStorage +# metaStorage eventMesh.server.metaStorage.metaStorageIntervalInMills=10000 eventMesh.server.metaStorage.fetchMetaStorageAddrIntervalInMills=20000 -#auto-ack +# auto-ack #eventMesh.server.defibus.client.comsumeTimeoutInMin=5 -#sleep interval between closing client of different group in server graceful shutdown +# sleep interval between closing client of different group in server graceful shutdown eventMesh.server.gracefulShutdown.sleepIntervalInMills=1000 eventMesh.server.rebalanceRedirect.sleepIntervalInMills=200 -#ip address blacklist +# ip address blacklist eventMesh.server.blacklist.ipv4=0.0.0.0/8,127.0.0.0/8,169.254.0.0/16,255.255.255.255/32 eventMesh.server.blacklist.ipv6=::/128,::1/128,ff00::/8 -#connector plugin +# connector plugin eventMesh.connector.plugin.type=standalone -#storage plugin +# storage plugin eventMesh.storage.plugin.type=standalone -#security plugin +# security plugin eventMesh.server.security.enabled=false eventMesh.security.plugin.type=security eventMesh.security.validation.type.token=false eventMesh.security.publickey= -#metaStorage plugin +# metaStorage plugin eventMesh.metaStorage.plugin.enabled=false eventMesh.metaStorage.plugin.type=nacos eventMesh.metaStorage.plugin.server-addr=127.0.0.1:8848 diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java index 6f15475881..37cb3d050f 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java @@ -194,8 +194,7 @@ public void shutdown() throws Exception { /** * Registers the processors required by the runtime module */ - public void registerProcessor(final Integer requestCode, final HttpRequestProcessor processor, - final ThreadPoolExecutor executor) { + public void registerProcessor(final Integer requestCode, final HttpRequestProcessor processor, final ThreadPoolExecutor executor) { AssertUtils.notNull(requestCode, "requestCode can't be null"); AssertUtils.notNull(processor, "processor can't be null"); AssertUtils.notNull(executor, "executor can't be null"); diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java index 763fa8e536..3b91498432 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshHTTPServer.java @@ -255,9 +255,9 @@ private void registerHTTPRequestProcessor() throws Exception { final SendAsyncRemoteEventProcessor sendAsyncRemoteEventProcessor = new SendAsyncRemoteEventProcessor(this); this.getHandlerService().register(sendAsyncRemoteEventProcessor, remoteMsgExecutor); - ThreadPoolExecutor adminExecutor = httpThreadPoolGroup.getAdminExecutor(); + ThreadPoolExecutor runtimeAdminExecutor = httpThreadPoolGroup.getRuntimeAdminExecutor(); final AdminMetricsProcessor adminMetricsProcessor = new AdminMetricsProcessor(this); - registerProcessor(RequestCode.ADMIN_METRICS.getRequestCode(), adminMetricsProcessor, adminExecutor); + registerProcessor(RequestCode.ADMIN_METRICS.getRequestCode(), adminMetricsProcessor, runtimeAdminExecutor); ThreadPoolExecutor clientManageExecutor = httpThreadPoolGroup.getClientManageExecutor(); final HeartBeatProcessor heartProcessor = new HeartBeatProcessor(this); diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/HTTPThreadPoolGroup.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/HTTPThreadPoolGroup.java index 9a7b93d0e6..4c675a0f85 100644 --- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/HTTPThreadPoolGroup.java +++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/HTTPThreadPoolGroup.java @@ -33,7 +33,7 @@ public class HTTPThreadPoolGroup implements ThreadPoolGroup { private ThreadPoolExecutor replyMsgExecutor; private ThreadPoolExecutor pushMsgExecutor; private ThreadPoolExecutor clientManageExecutor; - private ThreadPoolExecutor adminExecutor; + private ThreadPoolExecutor runtimeAdminExecutor; private ThreadPoolExecutor webhookExecutor; public HTTPThreadPoolGroup(EventMeshHTTPConfiguration eventMeshHttpConfiguration) { @@ -73,11 +73,11 @@ public void initThreadPool() { new LinkedBlockingQueue<>(eventMeshHttpConfiguration.getEventMeshServerClientManageBlockQSize()), "eventMesh-clientManage", true); - adminExecutor = ThreadPoolFactory.createThreadPoolExecutor( + // The runtimeAdminExecutor here is for the runtime.admin package and has nothing to do with the eventmesh-admin module. + runtimeAdminExecutor = ThreadPoolFactory.createThreadPoolExecutor( eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(), eventMeshHttpConfiguration.getEventMeshServerAdminThreadNum(), - new LinkedBlockingQueue<>(50), "eventMesh-admin", - true); + new LinkedBlockingQueue<>(50), "eventMesh-runtime-admin", true); replyMsgExecutor = ThreadPoolFactory.createThreadPoolExecutor( eventMeshHttpConfiguration.getEventMeshServerReplyMsgThreadNum(), @@ -96,8 +96,8 @@ public void shutdownThreadPool() { if (batchMsgExecutor != null) { batchMsgExecutor.shutdown(); } - if (adminExecutor != null) { - adminExecutor.shutdown(); + if (runtimeAdminExecutor != null) { + runtimeAdminExecutor.shutdown(); } if (clientManageExecutor != null) { clientManageExecutor.shutdown(); @@ -140,8 +140,8 @@ public ThreadPoolExecutor getClientManageExecutor() { return clientManageExecutor; } - public ThreadPoolExecutor getAdminExecutor() { - return adminExecutor; + public ThreadPoolExecutor getRuntimeAdminExecutor() { + return runtimeAdminExecutor; } public ThreadPoolExecutor getWebhookExecutor() {