You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by il...@apache.org on 2021/04/19 14:12:32 UTC
[ignite] branch master updated: IGNITE-14505 Print information
about a striped pool in local node metrics - Fixes #8988.
This is an automated email from the ASF dual-hosted git repository.
ilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 2b6cad5 IGNITE-14505 Print information about a striped pool in local node metrics - Fixes #8988.
2b6cad5 is described below
commit 2b6cad5f04898eb6ca93a266642f28da18496852
Author: Denis Mekhanikov <dm...@gmail.com>
AuthorDate: Mon Apr 19 17:03:59 2021 +0300
IGNITE-14505 Print information about a striped pool in local node metrics - Fixes #8988.
Signed-off-by: Ilya Kasnacheev <il...@gmail.com>
---
.../org/apache/ignite/internal/IgniteKernal.java | 21 +++++++++++++++------
.../ignite/internal/GridNodeMetricsLogSelfTest.java | 1 +
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index f280ce5..5ad333a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -1534,7 +1534,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
private final DecimalFormat dblFmt = doubleFormat();
@Override public void run() {
- ackNodeMetrics(dblFmt, execSvc, sysExecSvc, customExecSvcs);
+ ackNodeMetrics(dblFmt, execSvc, sysExecSvc, stripedExecSvc, customExecSvcs);
}
}, metricsLogFreq, metricsLogFreq);
}
@@ -1580,19 +1580,26 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
* @param execSvc Service to create a description for.
*/
private String createExecutorDescription(String execSvcName, ExecutorService execSvc) {
+ int poolSize = 0;
int poolActiveThreads = 0;
- int poolIdleThreads = 0;
int poolQSize = 0;
if (execSvc instanceof ThreadPoolExecutor) {
ThreadPoolExecutor exec = (ThreadPoolExecutor)execSvc;
- int poolSize = exec.getPoolSize();
-
+ poolSize = exec.getPoolSize();
poolActiveThreads = Math.min(poolSize, exec.getActiveCount());
- poolIdleThreads = poolSize - poolActiveThreads;
poolQSize = exec.getQueue().size();
}
+ else if (execSvc instanceof StripedExecutor) {
+ StripedExecutor exec = (StripedExecutor) execSvc;
+
+ poolSize = exec.stripesCount();
+ poolActiveThreads = exec.activeStripesCount();
+ poolQSize = exec.queueSize();
+ }
+
+ int poolIdleThreads = poolSize - poolActiveThreads;
return execSvcName + " [active=" + poolActiveThreads + ", idle=" + poolIdleThreads + ", qSize=" + poolQSize + "]";
}
@@ -2243,6 +2250,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
private void ackNodeMetrics(DecimalFormat dblFmt,
ExecutorService execSvc,
ExecutorService sysExecSvc,
+ ExecutorService stripedExecSvc,
Map<String, ? extends ExecutorService> customExecSvcs
) {
if (!log.isInfoEnabled())
@@ -2321,7 +2329,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
.a(dataStorageInfo)
.a(" ^-- Outbound messages queue [size=").a(m.getOutboundMessagesQueueSize()).a("]").nl()
.a(" ^-- ").a(createExecutorDescription("Public thread pool", execSvc)).nl()
- .a(" ^-- ").a(createExecutorDescription("System thread pool", sysExecSvc));
+ .a(" ^-- ").a(createExecutorDescription("System thread pool", sysExecSvc)).nl()
+ .a(" ^-- ").a(createExecutorDescription("Striped thread pool", stripedExecSvc));
if (customExecSvcs != null) {
for (Map.Entry<String, ? extends ExecutorService> entry : customExecSvcs.entrySet())
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridNodeMetricsLogSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridNodeMetricsLogSelfTest.java
index ce1943b..21e6ea9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridNodeMetricsLogSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridNodeMetricsLogSelfTest.java
@@ -129,6 +129,7 @@ public class GridNodeMetricsLogSelfTest extends GridCommonAbstractTest {
assertTrue(msg, fullLog.matches("(?s).*Outbound messages queue \\[size=.*].*"));
assertTrue(msg, fullLog.matches("(?s).*Public thread pool \\[active=.*, idle=.*, qSize=.*].*"));
assertTrue(msg, fullLog.matches("(?s).*System thread pool \\[active=.*, idle=.*, qSize=.*].*"));
+ assertTrue(msg, fullLog.matches("(?s).*Striped thread pool \\[active=.*, idle=.*, qSize=.*].*"));
assertTrue(msg, fullLog.matches("(?s).*" + CUSTOM_EXECUTOR_0 + " \\[active=.*, idle=.*, qSize=.*].*"));
assertTrue(msg, fullLog.matches("(?s).*" + CUSTOM_EXECUTOR_1 + " \\[active=.*, idle=.*, qSize=.*].*"));
}