Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add threadpool wait time metric #9681

Merged
merged 1 commit into from
Sep 12, 2023
Merged

Conversation

jed326
Copy link
Collaborator

@jed326 jed326 commented Sep 1, 2023

Description

Adds threadpool wait time metric for threadpool executors that support TimedRunnable

Sample output excerpt:

curl "localhost:9200/_nodes/stats/thread_pool?pretty&human"
"remote_refresh_retry" : {
          "threads" : 0,
          "queue" : 0,
          "active" : 0,
          "rejected" : 0,
          "largest" : 0,
          "completed" : 0
        },
        "search" : {
          "threads" : 2,
          "queue" : 0,
          "active" : 0,
          "rejected" : 0,
          "largest" : 2,
          "completed" : 2,
          "total_wait_time" : "629.9micros",
          "total_wait_time_in_nanos" : 629932
        },
        "search_throttled" : {
          "threads" : 0,
          "queue" : 0,
          "active" : 0,
          "rejected" : 0,
          "largest" : 0,
          "completed" : 0,
          "total_wait_time" : "0s",
          "total_wait_time_in_nanos" : 0
        },
dengjay@88665a3f24d4 OpenSearch % curl "localhost:9200/_cat/thread_pool?v&h=name,twt"
name                         twt
analyze                       -1
fetch_shard_started           -1
fetch_shard_store             -1
flush                         -1
force_merge                   -1
generic                       -1
get                           -1
index_searcher                0s
listener                      -1
management                    -1
refresh                       -1
remote_purge                  -1
remote_refresh_retry          -1
search               784.9micros
search_throttled              0s
snapshot                      -1
system_read                   -1
system_write                  -1
translog_sync                 -1
translog_transfer             -1
warmer                        -1
write                         -1
dengjay@88665a3f24d4 OpenSearch % curl "localhost:9200/_cat/thread_pool?help"
node_name         | nn  | node name                                          
node_id           | id  | persistent node id                                 
ephemeral_node_id | eid | ephemeral node id                                  
pid               | p   | process id                                         
host              | h   | host name                                          
ip                | i   | ip address                                         
port              | po  | bound transport port                               
name              | n   | thread pool name                                   
type              | t   | thread pool type                                   
active            | a   | number of active threads                           
pool_size         | psz | number of threads                                  
queue             | q   | number of tasks currently in queue                 
queue_size        | qs  | maximum number of tasks permitted in queue         
rejected          | r   | number of rejected tasks                           
largest           | l   | highest number of seen active threads              
completed         | c   | number of completed tasks                          
total_wait_time   | twt | total time tasks spent waiting in thread_pool queue
core              | cr  | core number of threads in a scaling thread pool    
max               | mx  | maximum number of threads in a scaling thread pool 
size              | sz  | number of threads in a fixed thread pool           
keep_alive        | ka  | thread keep alive time                             

Related Issues

Resolves #9645

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

Compatibility status:

Checks if related components are compatible with change aac0c35

Incompatible components

Skipped components

Compatible components

Compatible components: [https://github.com/opensearch-project/security-analytics.git, https://github.com/opensearch-project/custom-codecs.git, https://github.com/opensearch-project/security.git, https://github.com/opensearch-project/opensearch-oci-object-storage.git, https://github.com/opensearch-project/index-management.git, https://github.com/opensearch-project/geospatial.git, https://github.com/opensearch-project/sql.git, https://github.com/opensearch-project/job-scheduler.git, https://github.com/opensearch-project/notifications.git, https://github.com/opensearch-project/observability.git, https://github.com/opensearch-project/neural-search.git, https://github.com/opensearch-project/k-nn.git, https://github.com/opensearch-project/cross-cluster-replication.git, https://github.com/opensearch-project/alerting.git, https://github.com/opensearch-project/performance-analyzer.git, https://github.com/opensearch-project/anomaly-detection.git, https://github.com/opensearch-project/performance-analyzer-rca.git, https://github.com/opensearch-project/ml-commons.git, https://github.com/opensearch-project/asynchronous-search.git, https://github.com/opensearch-project/common-utils.git, https://github.com/opensearch-project/reporting.git]

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

Gradle Check (Jenkins) Run Completed with:

@codecov
Copy link

codecov bot commented Sep 1, 2023

Codecov Report

Merging #9681 (aac0c35) into main (c100c0c) will decrease coverage by 0.06%.
Report is 7 commits behind head on main.
The diff coverage is 64.51%.

@@             Coverage Diff              @@
##               main    #9681      +/-   ##
============================================
- Coverage     71.16%   71.11%   -0.06%     
+ Complexity    58114    58051      -63     
============================================
  Files          4824     4824              
  Lines        273897   273921      +24     
  Branches      39910    39915       +5     
============================================
- Hits         194926   194788     -138     
- Misses        62573    62769     +196     
+ Partials      16398    16364      -34     
Files Changed Coverage Δ
...main/java/org/opensearch/common/collect/Tuple.java 64.70% <ø> (ø)
...java/org/opensearch/common/crypto/DataKeyPair.java 0.00% <ø> (ø)
...h/common/crypto/DecryptedRangedStreamProvider.java 0.00% <ø> (ø)
...g/opensearch/compress/spi/CompressionProvider.java 100.00% <ø> (ø)
...ensearch/rest/action/cat/RestThreadPoolAction.java 11.94% <0.00%> (-0.19%) ⬇️
...ensearch/common/util/concurrent/TimedRunnable.java 60.00% <33.33%> (-2.97%) ⬇️
...ava/org/opensearch/threadpool/ThreadPoolStats.java 77.64% <54.54%> (-3.69%) ⬇️
...ent/QueueResizingOpenSearchThreadPoolExecutor.java 55.55% <66.66%> (+0.38%) ⬆️
...ain/java/org/opensearch/threadpool/ThreadPool.java 82.33% <80.00%> (-1.34%) ⬇️
...cli/src/main/java/org/opensearch/cli/Terminal.java 74.73% <100.00%> (ø)
... and 2 more

... and 446 files with indirect coverage changes

@sohami sohami merged commit 1aad5a3 into opensearch-project:main Sep 12, 2023
11 of 12 checks passed
@sohami
Copy link
Collaborator

sohami commented Sep 12, 2023

@reta Just wanted to confirm if we can merge the changes in 2.x now or is there any guidance to wait for some time ? I see the branch for 2.10 is already cut so probably should be fine to merge in 2.x.

@reta
Copy link
Collaborator

reta commented Sep 12, 2023

@reta Just wanted to confirm if we can merge the changes in 2.x now

Yeah, 2.x is certainly OK (it is 2.11 already)

@reta reta added backport 2.x Backport to 2.x branch v3.0.0 Issues and PRs related to version 3.0.0 v2.11.0 Issues and PRs related to version 2.11.0 labels Sep 12, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch/backport-2.x
# Create a new branch
git switch --create backport/backport-9681-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 1aad5a3f1b6a3f4b3521add022b367323a2b327f
# Push it to GitHub
git push --set-upstream origin backport/backport-9681-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-9681-to-2.x.

@jed326
Copy link
Collaborator Author

jed326 commented Sep 12, 2023

Will stage the manual backport + main bwc changes together for 2.11

jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 12, 2023
@@ -1,3 +1,30 @@
"Test cat thread_pool total_wait_time output":
- skip:
version: " - 3.0.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was supposed to be 2.99.99 as well....will fix this in the backport/bwc PRs 🤦‍♂️

jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 12, 2023
jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 12, 2023
@jed326
Copy link
Collaborator Author

jed326 commented Sep 12, 2023

Could you please add test case(s) to rest-api-spec / cat.thread_pool ? We also need documentation update (https://github.com/opensearch-project/documentation-website) for this feature since it changes the APIs.

Opened a doc issue: opensearch-project/documentation-website#5007

jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 12, 2023
jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 12, 2023
jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 13, 2023
jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 13, 2023
jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 13, 2023
jed326 added a commit to jed326/OpenSearch that referenced this pull request Sep 13, 2023
reta pushed a commit that referenced this pull request Sep 13, 2023
@jed326 jed326 deleted the 9645 branch September 13, 2023 19:10
sarthakaggarwal97 pushed a commit to sarthakaggarwal97/OpenSearch that referenced this pull request Sep 20, 2023
brusic pushed a commit to brusic/OpenSearch that referenced this pull request Sep 25, 2023
vikasvb90 pushed a commit to vikasvb90/OpenSearch that referenced this pull request Oct 10, 2023
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
@sohami sohami mentioned this pull request May 21, 2024
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch backport-failed v2.11.0 Issues and PRs related to version 2.11.0 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Concurrent Segment Search] Implement thread_pool.pool_wait_time
3 participants