You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by na...@apache.org on 2021/11/19 11:55:54 UTC
[ignite] branch ignite-2.12 updated: IGNITE-15183 Thin client: Add requests thread pool monitoring - Fixes #9525.
This is an automated email from the ASF dual-hosted git repository.
namelchev pushed a commit to branch ignite-2.12
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/ignite-2.12 by this push:
new 1977c26 IGNITE-15183 Thin client: Add requests thread pool monitoring - Fixes #9525.
1977c26 is described below
commit 1977c26c3537a16378e1ba08407b76fd4177825b
Author: Vladimir Steshin <vl...@gmail.com>
AuthorDate: Thu Nov 11 18:28:59 2021 +0300
IGNITE-15183 Thin client: Add requests thread pool monitoring - Fixes #9525.
Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>
(cherry picked from commit 60852caa0ce327c204b8ea7721c9c84b79543ee9)
---
.../processors/odbc/ClientListenerProcessor.java | 20 ++----------
.../internal/processors/pool/PoolProcessor.java | 36 ++++++++++++++++++++++
.../org/apache/ignite/internal/GridMBeansTest.java | 1 +
.../ignite/thread/ThreadPoolMetricsTest.java | 1 +
4 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java
index 6c85440..b0a260f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/ClientListenerProcessor.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicLong;
import javax.cache.configuration.Factory;
import javax.management.JMException;
@@ -36,7 +35,6 @@ import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.OdbcConfiguration;
import org.apache.ignite.configuration.SqlConnectorConfiguration;
import org.apache.ignite.internal.GridKernalContext;
-import org.apache.ignite.internal.managers.communication.GridIoPolicy;
import org.apache.ignite.internal.managers.systemview.walker.ClientConnectionViewWalker;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.odbc.jdbc.JdbcConnectionContext;
@@ -54,8 +52,6 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.mxbean.ClientProcessorMXBean;
import org.apache.ignite.spi.IgnitePortProtocol;
import org.apache.ignite.spi.systemview.view.ClientConnectionView;
-import org.apache.ignite.thread.IgniteThreadPoolExecutor;
-import org.apache.ignite.thread.OomExceptionHandler;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -134,15 +130,7 @@ public class ClientListenerProcessor extends GridProcessorAdapter {
throw new IgniteCheckedException("Failed to resolve client connector host: " + host, e);
}
- execSvc = new IgniteThreadPoolExecutor(
- "client-connector",
- cfg.getIgniteInstanceName(),
- cliConnCfg.getThreadPoolSize(),
- cliConnCfg.getThreadPoolSize(),
- 0,
- new LinkedBlockingQueue<Runnable>(),
- GridIoPolicy.UNDEFINED,
- new OomExceptionHandler(ctx));
+ execSvc = ctx.pools().getThinClientExecutorService();
Exception lastErr = null;
@@ -366,11 +354,7 @@ public class ClientListenerProcessor extends GridProcessorAdapter {
ctx.ports().deregisterPorts(getClass());
- if (execSvc != null) {
- U.shutdownNow(getClass(), execSvc, log);
-
- execSvc = null;
- }
+ execSvc = null;
if (!U.IGNITE_MBEANS_DISABLED)
unregisterMBean();
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java
index fbf2fc6..92fb961 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/pool/PoolProcessor.java
@@ -198,6 +198,10 @@ public class PoolProcessor extends GridProcessorAdapter {
@GridToStringExclude
private ThreadPoolExecutor rebalanceExecSvc;
+ /** Executor service for thin clients. */
+ @GridToStringExclude
+ private ExecutorService thinClientExec;
+
/** Rebalance striped executor service. */
@GridToStringExclude
private IgniteStripedThreadPoolExecutor rebalanceStripedExecSvc;
@@ -498,6 +502,18 @@ public class PoolProcessor extends GridProcessorAdapter {
rebalanceExecSvc.allowCoreThreadTimeOut(true);
+ if (cfg.getClientConnectorConfiguration() != null) {
+ thinClientExec = new IgniteThreadPoolExecutor(
+ "client-connector",
+ cfg.getIgniteInstanceName(),
+ cfg.getClientConnectorConfiguration().getThreadPoolSize(),
+ cfg.getClientConnectorConfiguration().getThreadPoolSize(),
+ 0,
+ new LinkedBlockingQueue<>(),
+ GridIoPolicy.UNDEFINED,
+ oomeHnd);
+ }
+
rebalanceStripedExecSvc = createStripedThreadPoolExecutor(
cfg.getRebalanceThreadPoolSize(),
cfg.getIgniteInstanceName(),
@@ -563,6 +579,9 @@ public class PoolProcessor extends GridProcessorAdapter {
monitorStripedPool("StripedExecutor", stripedExecSvc);
}
+ if (thinClientExec != null)
+ monitorExecutor("GridThinClientExecutor", thinClientExec);
+
if (customExecs != null) {
for (Map.Entry<String, ? extends ExecutorService> entry : customExecs.entrySet())
monitorExecutor(entry.getKey(), entry.getValue());
@@ -820,6 +839,15 @@ public class PoolProcessor extends GridProcessorAdapter {
}
/**
+ * Executor service for thin clients.
+ *
+ * @return Executor service for thin clients.
+ */
+ public ExecutorService getThinClientExecutorService() {
+ return thinClientExec;
+ }
+
+ /**
* Executor service that is in charge of processing unorderable rebalance messages.
*
* @return Executor service that is in charge of processing unorderable rebalance messages.
@@ -976,6 +1004,9 @@ public class PoolProcessor extends GridProcessorAdapter {
registerStripedExecutorMBean(mbMgr, "StripedExecutor", stripedExecSvc);
}
+ if (thinClientExec != null)
+ registerExecutorMBean(mbMgr, "GridThinClientExecutor", thinClientExec);
+
if (customExecs != null) {
for (Map.Entry<String, ? extends ExecutorService> entry : customExecs.entrySet())
registerExecutorMBean(mbMgr, entry.getKey(), entry.getValue());
@@ -1098,6 +1129,11 @@ public class PoolProcessor extends GridProcessorAdapter {
callbackExecSvc = null;
+ if (thinClientExec != null)
+ U.shutdownNow(getClass(), thinClientExec, log);
+
+ thinClientExec = null;
+
if (!F.isEmpty(customExecs)) {
for (ThreadPoolExecutor exec : customExecs.values())
U.shutdownNow(getClass(), exec, log);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridMBeansTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridMBeansTest.java
index 7f21037..c5a44a4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridMBeansTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridMBeansTest.java
@@ -72,6 +72,7 @@ public class GridMBeansTest extends GridCommonAbstractTest {
checkBean("Thread Pools", "GridClassLoadingExecutor", "Terminated", false);
checkBean("Thread Pools", "GridQueryExecutor", "Terminated", false);
checkBean("Thread Pools", "GridSchemaExecutor", "Terminated", false);
+ checkBean("Thread Pools", "GridThinClientExecutor", "Terminated", false);
checkBean("Thread Pools", "StripedExecutor", "Terminated", false);
// custom executors
diff --git a/modules/core/src/test/java/org/apache/ignite/thread/ThreadPoolMetricsTest.java b/modules/core/src/test/java/org/apache/ignite/thread/ThreadPoolMetricsTest.java
index a99cf6e..12c9527 100644
--- a/modules/core/src/test/java/org/apache/ignite/thread/ThreadPoolMetricsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/thread/ThreadPoolMetricsTest.java
@@ -57,6 +57,7 @@ public class ThreadPoolMetricsTest extends GridCommonAbstractTest {
metricName(THREAD_POOLS, "GridQueryExecutor"),
metricName(THREAD_POOLS, "GridSchemaExecutor"),
metricName(THREAD_POOLS, "GridRebalanceExecutor"),
+ metricName(THREAD_POOLS, "GridThinClientExecutor"),
metricName(THREAD_POOLS, "GridRebalanceStripedExecutor"),
metricName(THREAD_POOLS, "GridDataStreamExecutor")
);