You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/11/03 16:50:08 UTC

[GitHub] [druid] wjhypo opened a new pull request #11113: Add more metrics for Jetty server thread pool usage

wjhypo opened a new pull request #11113:
URL: https://github.com/apache/druid/pull/11113


   <!-- Thanks for trying to help us make Apache Druid be the best it can be! Please fill out as much of the following information as is possible (where relevant, and remove it when irrelevant) to help make the intention and scope of this PR clear in order to ease review. -->
   
   <!-- Please read the doc for contribution (https://github.com/apache/druid/blob/master/CONTRIBUTING.md) before making this PR. Also, once you open a PR, please _avoid using force pushes and rebasing_ since these make it difficult for reviewers to see what you've changed in response to their reviews. See [the 'If your pull request shows conflicts with master' section](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#if-your-pull-request-shows-conflicts-with-master) for more details. -->
   
   
   <!-- Replace XXXX with the id of the issue fixed in this PR. Remove this section if there is no corresponding issue. Don't reference the issue in the title of this pull-request. -->
   
   <!-- If you are a committer, follow the PR action item checklist for committers:
   https://github.com/apache/druid/blob/master/dev/committer-instructions.md#pr-and-issue-action-item-checklist-for-committers. -->
   
   ### Description
   
   Add more metrics for jetty server thread pool usage so we know if we have allocated enough http threads to handle requests.
   
   <!-- Describe the goal of this PR, what problem are you fixing. If there is a corresponding issue (referenced above), it's not necessary to repeat the description here, however, you may choose to keep one summary sentence. -->
   
   <!-- Describe your patch: what did you change in code? How did you fix the problem? -->
   
   <!-- If there are several relatively logically separate changes in this PR, create a mini-section for each of them. For example: -->
   
   <!--
   In each section, please describe design decisions made, including:
    - Choice of algorithms
    - Behavioral aspects. What configuration values are acceptable? How are corner cases and error conditions handled, such as when there are insufficient resources?
    - Class organization and design (how the logic is split between classes, inheritance, composition, design patterns)
    - Method organization and design (how the logic is split between methods, parameters and return types)
    - Naming (class, method, API, configuration, HTTP endpoint, names of emitted metrics)
   -->
   
   
   <!-- It's good to describe an alternative design (or mention an alternative name) for every design (or naming) decision point and compare the alternatives with the designs that you've implemented (or the names you've chosen) to highlight the advantages of the chosen designs and names. -->
   
   <!-- If there was a discussion of the design of the feature implemented in this PR elsewhere (e. g. a "Proposal" issue, any other issue, or a thread in the development mailing list), link to that discussion from this PR description and explain what have changed in your final design compared to your original proposal or the consensus version in the end of the discussion. If something hasn't changed since the original discussion, you can omit a detailed discussion of those aspects of the design here, perhaps apart from brief mentioning for the sake of readability of this PR description. -->
   
   <!-- Some of the aspects mentioned above may be omitted for simple and small changes. -->
   
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not all of these items apply to every PR. Remove the items which are not done or not relevant to the PR. None of the items from the checklist below are strictly necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   - [x] been self-reviewed.
   - [x] added documentation for new or modified features or behaviors.
   - [x] been tested in a test Druid cluster.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-958707323


   @wjhypo - can you address these test failures so that the PR can be merged. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-962437536


   @wjhypo You would have to add the words (that docs check is flagging as typo) to the `.spelling` file. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-959725385


   > @wjhypo - can you address these test failures so that the PR can be merged.
   
   Thanks Abhishek, the test failure was due to code coverage, I added more test to see if it addresses it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 closed pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 closed pull request #11113:
URL: https://github.com/apache/druid/pull/11113


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 closed pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 closed pull request #11113:
URL: https://github.com/apache/druid/pull/11113


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 merged pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 merged pull request #11113:
URL: https://github.com/apache/druid/pull/11113


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 closed pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 closed pull request #11113:
URL: https://github.com/apache/druid/pull/11113


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 closed pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 closed pull request #11113:
URL: https://github.com/apache/druid/pull/11113


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 closed pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 closed pull request #11113:
URL: https://github.com/apache/druid/pull/11113


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 commented on a change in pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on a change in pull request #11113:
URL: https://github.com/apache/druid/pull/11113#discussion_r614618937



##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -499,6 +503,23 @@ public boolean doMonitor(ServiceEmitter emitter)
       final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();
       MonitorUtils.addDimensionsToBuilder(builder, dimensions);
       emitter.emit(builder.build("jetty/numOpenConnections", ACTIVE_CONNECTIONS.get()));
+      ThreadPool jettyServerThreadPool = JETTY_SERVER_THREAD_POOL.get();
+      emitter.emit(builder.build("jetty/threadPoolNumTotalThreads", jettyServerThreadPool.getThreads()));
+      emitter.emit(builder.build("jetty/threadPoolNumIdleThreads", jettyServerThreadPool.getIdleThreads()));
+      emitter.emit(builder.build("jetty/threadPoolIsLowOnThreads", jettyServerThreadPool.isLowOnThreads() ? 1 : 0));
+      if (jettyServerThreadPool instanceof ThreadPool.SizedThreadPool) {

Review comment:
       when will this be true? As in, where is threadpool of this type being configured? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] FrankChen021 commented on a change in pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
FrankChen021 commented on a change in pull request #11113:
URL: https://github.com/apache/druid/pull/11113#discussion_r633402022



##########
File path: docs/design/extensions-contrib/dropwizard.md
##########
@@ -629,6 +629,38 @@ Latest default metrics mapping can be found [here] (https://github.com/apache/dr
       "priority"
     ],
     "type": "gauge"
+  },
+  "jetty/numOpenConnections": {
+    "dimensions": [],
+    "type": "gauge"
+  },
+  "jetty/threadPoolNumTotalThreads": {

Review comment:
       I think it would be more clear to name the metric as `jetty/threadPool/total`. So do other names.

##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -101,6 +103,7 @@
   private static final Logger log = new Logger(JettyServerModule.class);
 
   private static final AtomicInteger ACTIVE_CONNECTIONS = new AtomicInteger();
+  private static final AtomicReference<ThreadPool> JETTY_SERVER_THREAD_POOL = new AtomicReference<>(null);

Review comment:
       Why is `AtomicReference` used ? Thread pool of jetty is initialized during start up and won't be changed. I think we could declare this variable as `QueuedThreadPool` directly.

##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -499,6 +503,23 @@ public boolean doMonitor(ServiceEmitter emitter)
       final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();
       MonitorUtils.addDimensionsToBuilder(builder, dimensions);
       emitter.emit(builder.build("jetty/numOpenConnections", ACTIVE_CONNECTIONS.get()));
+      ThreadPool jettyServerThreadPool = JETTY_SERVER_THREAD_POOL.get();
+      emitter.emit(builder.build("jetty/threadPoolNumTotalThreads", jettyServerThreadPool.getThreads()));
+      emitter.emit(builder.build("jetty/threadPoolNumIdleThreads", jettyServerThreadPool.getIdleThreads()));
+      emitter.emit(builder.build("jetty/threadPoolIsLowOnThreads", jettyServerThreadPool.isLowOnThreads() ? 1 : 0));
+      if (jettyServerThreadPool instanceof ThreadPool.SizedThreadPool) {
+        emitter.emit(builder.build("jetty/threadPoolMinThreads",
+                                   ((ThreadPool.SizedThreadPool) jettyServerThreadPool).getMinThreads()));
+        emitter.emit(builder.build("jetty/threadPoolMaxThreads",
+                                   ((ThreadPool.SizedThreadPool) jettyServerThreadPool).getMaxThreads()));
+      }
+      if (jettyServerThreadPool instanceof QueuedThreadPool) {

Review comment:
       I don't think this check is necessary. `jettyServerThreadPool` could be declared as `QueuedThreadPool`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-958707323


   @wjhypo - can you address these test failures so that the PR can be merged. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-962592737


   Thank you @wjhypo for your contribution. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] FrankChen021 commented on a change in pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
FrankChen021 commented on a change in pull request #11113:
URL: https://github.com/apache/druid/pull/11113#discussion_r633405268



##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -499,6 +503,23 @@ public boolean doMonitor(ServiceEmitter emitter)
       final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();
       MonitorUtils.addDimensionsToBuilder(builder, dimensions);
       emitter.emit(builder.build("jetty/numOpenConnections", ACTIVE_CONNECTIONS.get()));
+      ThreadPool jettyServerThreadPool = JETTY_SERVER_THREAD_POOL.get();
+      emitter.emit(builder.build("jetty/threadPoolNumTotalThreads", jettyServerThreadPool.getThreads()));
+      emitter.emit(builder.build("jetty/threadPoolNumIdleThreads", jettyServerThreadPool.getIdleThreads()));
+      emitter.emit(builder.build("jetty/threadPoolIsLowOnThreads", jettyServerThreadPool.isLowOnThreads() ? 1 : 0));
+      if (jettyServerThreadPool instanceof ThreadPool.SizedThreadPool) {
+        emitter.emit(builder.build("jetty/threadPoolMinThreads",
+                                   ((ThreadPool.SizedThreadPool) jettyServerThreadPool).getMinThreads()));
+        emitter.emit(builder.build("jetty/threadPoolMaxThreads",
+                                   ((ThreadPool.SizedThreadPool) jettyServerThreadPool).getMaxThreads()));
+      }
+      if (jettyServerThreadPool instanceof QueuedThreadPool) {

Review comment:
       I don't think this check is necessary. `jettyServerThreadPool` could be declared as `QueuedThreadPool`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-958707323


   @wjhypo - can you address these test failures so that the PR can be merged. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on a change in pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on a change in pull request #11113:
URL: https://github.com/apache/druid/pull/11113#discussion_r634841505



##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -499,6 +503,23 @@ public boolean doMonitor(ServiceEmitter emitter)
       final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();
       MonitorUtils.addDimensionsToBuilder(builder, dimensions);
       emitter.emit(builder.build("jetty/numOpenConnections", ACTIVE_CONNECTIONS.get()));
+      ThreadPool jettyServerThreadPool = JETTY_SERVER_THREAD_POOL.get();
+      emitter.emit(builder.build("jetty/threadPoolNumTotalThreads", jettyServerThreadPool.getThreads()));
+      emitter.emit(builder.build("jetty/threadPoolNumIdleThreads", jettyServerThreadPool.getIdleThreads()));
+      emitter.emit(builder.build("jetty/threadPoolIsLowOnThreads", jettyServerThreadPool.isLowOnThreads() ? 1 : 0));
+      if (jettyServerThreadPool instanceof ThreadPool.SizedThreadPool) {

Review comment:
       Thanks! 1) The min and max threads are just for operation convenience, their value don't change but it's very useful to plot them in the same graph as busy busy threads, for example, to get an idea on the usage, after all, it's not convenient to check druid runtime.properties each time to get the max and min value. Uses don't need them can just not ignore these two metrics. 2) I have simplified the logic to just use QueuedThreadPool to get rid of all the unnecessary checks.

##########
File path: docs/design/extensions-contrib/dropwizard.md
##########
@@ -629,6 +629,38 @@ Latest default metrics mapping can be found [here] (https://github.com/apache/dr
       "priority"
     ],
     "type": "gauge"
+  },
+  "jetty/numOpenConnections": {
+    "dimensions": [],
+    "type": "gauge"
+  },
+  "jetty/threadPoolNumTotalThreads": {

Review comment:
       Thanks! Addressed.

##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -101,6 +103,7 @@
   private static final Logger log = new Logger(JettyServerModule.class);
 
   private static final AtomicInteger ACTIVE_CONNECTIONS = new AtomicInteger();
+  private static final AtomicReference<ThreadPool> JETTY_SERVER_THREAD_POOL = new AtomicReference<>(null);

Review comment:
       Thanks! Addressed.

##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -499,6 +503,23 @@ public boolean doMonitor(ServiceEmitter emitter)
       final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();
       MonitorUtils.addDimensionsToBuilder(builder, dimensions);
       emitter.emit(builder.build("jetty/numOpenConnections", ACTIVE_CONNECTIONS.get()));
+      ThreadPool jettyServerThreadPool = JETTY_SERVER_THREAD_POOL.get();
+      emitter.emit(builder.build("jetty/threadPoolNumTotalThreads", jettyServerThreadPool.getThreads()));
+      emitter.emit(builder.build("jetty/threadPoolNumIdleThreads", jettyServerThreadPool.getIdleThreads()));
+      emitter.emit(builder.build("jetty/threadPoolIsLowOnThreads", jettyServerThreadPool.isLowOnThreads() ? 1 : 0));
+      if (jettyServerThreadPool instanceof ThreadPool.SizedThreadPool) {
+        emitter.emit(builder.build("jetty/threadPoolMinThreads",
+                                   ((ThreadPool.SizedThreadPool) jettyServerThreadPool).getMinThreads()));
+        emitter.emit(builder.build("jetty/threadPoolMaxThreads",
+                                   ((ThreadPool.SizedThreadPool) jettyServerThreadPool).getMaxThreads()));
+      }
+      if (jettyServerThreadPool instanceof QueuedThreadPool) {

Review comment:
       Thanks! Addressed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] suneet-s commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
suneet-s commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-846069845


   Added `Design Review` because this commit adds new metrics


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-959725385


   > @wjhypo - can you address these test failures so that the PR can be merged.
   
   Thanks Abhishek, the test failure was due to code coverage, I added more test to see if it addresses it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-961314115


   @abhishekagarwal87 Should be fixed now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-961314115


   @abhishekagarwal87 Should be fixed now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 closed pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 closed pull request #11113:
URL: https://github.com/apache/druid/pull/11113


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on a change in pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on a change in pull request #11113:
URL: https://github.com/apache/druid/pull/11113#discussion_r615023941



##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -499,6 +503,23 @@ public boolean doMonitor(ServiceEmitter emitter)
       final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();
       MonitorUtils.addDimensionsToBuilder(builder, dimensions);
       emitter.emit(builder.build("jetty/numOpenConnections", ACTIVE_CONNECTIONS.get()));
+      ThreadPool jettyServerThreadPool = JETTY_SERVER_THREAD_POOL.get();
+      emitter.emit(builder.build("jetty/threadPoolNumTotalThreads", jettyServerThreadPool.getThreads()));
+      emitter.emit(builder.build("jetty/threadPoolNumIdleThreads", jettyServerThreadPool.getIdleThreads()));
+      emitter.emit(builder.build("jetty/threadPoolIsLowOnThreads", jettyServerThreadPool.isLowOnThreads() ? 1 : 0));
+      if (jettyServerThreadPool instanceof ThreadPool.SizedThreadPool) {

Review comment:
       https://github.com/apache/druid/blob/master/server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java#L210
   
   Hi Abhishek, QueuedThreadPool implements SizedThreadPool which in turn implements ThreadPool, here I am using the minimal casting to use methods I need in case in the future the implementation of the thread pool changes then at least some of the metrics still work, I guess I can also just check if jettyServerThreadPool instanceof QueuedThreadPool because it is the only implementation now.
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-961314115


   @abhishekagarwal87 Should be fixed now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-962208273


   @abhishekagarwal87 Hmmm, for some reason, the checks were passed and failed with new checks after you closed and reopened PR. One of the error was referring to the typo in the metric name but I'm not sure whether that should be a failing point. Could you advise on next steps?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-962497921


   > @wjhypo You would have to add the words (that docs check is flagging as typo) to the `.spelling` file.
   
   @abhishekagarwal87 Thanks for the pointer. Updated!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 commented on a change in pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on a change in pull request #11113:
URL: https://github.com/apache/druid/pull/11113#discussion_r615573763



##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -499,6 +503,23 @@ public boolean doMonitor(ServiceEmitter emitter)
       final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();
       MonitorUtils.addDimensionsToBuilder(builder, dimensions);
       emitter.emit(builder.build("jetty/numOpenConnections", ACTIVE_CONNECTIONS.get()));
+      ThreadPool jettyServerThreadPool = JETTY_SERVER_THREAD_POOL.get();
+      emitter.emit(builder.build("jetty/threadPoolNumTotalThreads", jettyServerThreadPool.getThreads()));
+      emitter.emit(builder.build("jetty/threadPoolNumIdleThreads", jettyServerThreadPool.getIdleThreads()));
+      emitter.emit(builder.build("jetty/threadPoolIsLowOnThreads", jettyServerThreadPool.isLowOnThreads() ? 1 : 0));
+      if (jettyServerThreadPool instanceof ThreadPool.SizedThreadPool) {

Review comment:
       > I guess I can also just check if jettyServerThreadPool instanceof QueuedThreadPool because it is the only implementation now.
   
   that makes sense. I am thinking that we would want to report the queue size and busy threads instead of min and max threads.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] FrankChen021 commented on a change in pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
FrankChen021 commented on a change in pull request #11113:
URL: https://github.com/apache/druid/pull/11113#discussion_r633404479



##########
File path: server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java
##########
@@ -101,6 +103,7 @@
   private static final Logger log = new Logger(JettyServerModule.class);
 
   private static final AtomicInteger ACTIVE_CONNECTIONS = new AtomicInteger();
+  private static final AtomicReference<ThreadPool> JETTY_SERVER_THREAD_POOL = new AtomicReference<>(null);

Review comment:
       Why is `AtomicReference` used ? Thread pool of jetty is initialized during start up and won't be changed. I think we could declare this variable as `QueuedThreadPool` directly.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] FrankChen021 commented on a change in pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
FrankChen021 commented on a change in pull request #11113:
URL: https://github.com/apache/druid/pull/11113#discussion_r633402022



##########
File path: docs/design/extensions-contrib/dropwizard.md
##########
@@ -629,6 +629,38 @@ Latest default metrics mapping can be found [here] (https://github.com/apache/dr
       "priority"
     ],
     "type": "gauge"
+  },
+  "jetty/numOpenConnections": {
+    "dimensions": [],
+    "type": "gauge"
+  },
+  "jetty/threadPoolNumTotalThreads": {

Review comment:
       I think it would be more clear to name the metric as `jetty/threadPool/total`. So do other names.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] wjhypo commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
wjhypo commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-959725385






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 commented on pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on pull request #11113:
URL: https://github.com/apache/druid/pull/11113#issuecomment-958707323


   @wjhypo - can you address these test failures so that the PR can be merged. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [druid] abhishekagarwal87 closed pull request #11113: Add more metrics for Jetty server thread pool usage

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 closed pull request #11113:
URL: https://github.com/apache/druid/pull/11113






-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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