You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ms...@apache.org on 2017/08/11 15:59:56 UTC

cassandra git commit: Add MBean to monitor max queued tasks

Repository: cassandra
Updated Branches:
  refs/heads/trunk d68357a44 -> f4da90aca


Add MBean to monitor max queued tasks

patch by Romain Hardouin; reviewed by Michael Shuler for CASSANDRA-12758


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f4da90ac
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f4da90ac
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f4da90ac

Branch: refs/heads/trunk
Commit: f4da90aca0e79664ea06212283f6cd5f9288d441
Parents: d68357a
Author: Romain Hardouin <ro...@yahoo.fr>
Authored: Thu Oct 6 22:36:07 2016 +0200
Committer: Michael Shuler <mi...@pbandjelly.org>
Committed: Fri Aug 11 08:36:36 2017 -0500

----------------------------------------------------------------------
 CHANGES.txt                                               |  1 +
 doc/source/operating/metrics.rst                          |  1 +
 src/java/org/apache/cassandra/concurrent/SEPExecutor.java |  2 +-
 src/java/org/apache/cassandra/metrics/SEPMetrics.java     | 10 ++++++++++
 4 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4da90ac/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index efd6716..988f93d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 4.0
+ * Expose tasks queue length via JMX (CASSANDRA-12758)
  * Fix race / ref leak in PendingRepairManager (CASSANDRA-13751)
  * Enable ppc64le runtime as unsupported architecture (CASSANDRA-13615)
  * Improve sstablemetadata output (CASSANDRA-11483)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4da90ac/doc/source/operating/metrics.rst
----------------------------------------------------------------------
diff --git a/doc/source/operating/metrics.rst b/doc/source/operating/metrics.rst
index a38d7c1..cfdd584 100644
--- a/doc/source/operating/metrics.rst
+++ b/doc/source/operating/metrics.rst
@@ -193,6 +193,7 @@ CompletedTasks        Counter        Number of tasks completed.
 TotalBlockedTasks     Counter        Number of tasks that were blocked due to queue saturation.
 CurrentlyBlockedTask  Counter        Number of tasks that are currently blocked due to queue saturation but on retry will become unblocked.
 MaxPoolSize           Gauge<Integer> The maximum number of threads in this pool.
+MaxTasksQueued        Gauge<Integer> The maximum number of tasks queued before a task get blocked.
 ===================== ============== ===========
 
 The following thread pools can be monitored.

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4da90ac/src/java/org/apache/cassandra/concurrent/SEPExecutor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/concurrent/SEPExecutor.java b/src/java/org/apache/cassandra/concurrent/SEPExecutor.java
index c87614b..add850a 100644
--- a/src/java/org/apache/cassandra/concurrent/SEPExecutor.java
+++ b/src/java/org/apache/cassandra/concurrent/SEPExecutor.java
@@ -35,7 +35,7 @@ public class SEPExecutor extends AbstractLocalAwareExecutorService
 
     public final int maxWorkers;
     public final String name;
-    private final int maxTasksQueued;
+    public final int maxTasksQueued;
     private final SEPMetrics metrics;
 
     // stores both a set of work permits and task permits:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/f4da90ac/src/java/org/apache/cassandra/metrics/SEPMetrics.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/metrics/SEPMetrics.java b/src/java/org/apache/cassandra/metrics/SEPMetrics.java
index 35f02b4..dd1d2d6 100644
--- a/src/java/org/apache/cassandra/metrics/SEPMetrics.java
+++ b/src/java/org/apache/cassandra/metrics/SEPMetrics.java
@@ -41,6 +41,8 @@ public class SEPMetrics
     public final Gauge<Long> pendingTasks;
     /** Maximum number of threads before it will start queuing tasks */
     public final Gauge<Integer> maxPoolSize;
+    /** Maximum number of tasks queued before a task get blocked */
+    public final Gauge<Integer> maxTasksQueued;
 
     private MetricNameFactory factory;
 
@@ -85,6 +87,13 @@ public class SEPMetrics
                 return executor.maxWorkers;
             }
         });
+        maxTasksQueued =  Metrics.register(factory.createMetricName("MaxTasksQueued"), new Gauge<Integer>()
+        {
+            public Integer getValue()
+            {
+                return executor.maxTasksQueued;
+            }
+        });
     }
 
     public void release()
@@ -95,5 +104,6 @@ public class SEPMetrics
         Metrics.remove(factory.createMetricName("TotalBlockedTasks"));
         Metrics.remove(factory.createMetricName("CurrentlyBlockedTasks"));
         Metrics.remove(factory.createMetricName("MaxPoolSize"));
+        Metrics.remove(factory.createMetricName("MaxTasksQueued"));
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org