2014-01-25 12:20:46 -05:00
|
|
|
[[cat-thread-pool]]
|
2014-05-16 15:43:35 -04:00
|
|
|
== cat thread pool
|
2014-01-25 12:20:46 -05:00
|
|
|
|
|
|
|
The `thread_pool` command shows cluster wide thread pool statistics per node. By default the active, queue and rejected
|
2016-08-03 23:02:13 -04:00
|
|
|
statistics are returned for all thread pools.
|
2014-01-25 12:20:46 -05:00
|
|
|
|
2017-05-03 20:58:23 -04:00
|
|
|
[source,js]
|
2014-01-25 12:20:46 -05:00
|
|
|
--------------------------------------------------
|
2017-05-03 20:58:23 -04:00
|
|
|
GET /_cat/thread_pool
|
2014-01-25 12:20:46 -05:00
|
|
|
--------------------------------------------------
|
2017-05-03 20:58:23 -04:00
|
|
|
// CONSOLE
|
|
|
|
|
|
|
|
Which looks like:
|
|
|
|
|
|
|
|
[source,txt]
|
|
|
|
--------------------------------------------------
|
2018-04-17 06:46:15 -04:00
|
|
|
node-0 analyze 0 0 0
|
2018-06-20 20:36:37 -04:00
|
|
|
...
|
2017-05-03 20:58:23 -04:00
|
|
|
node-0 fetch_shard_started 0 0 0
|
|
|
|
node-0 fetch_shard_store 0 0 0
|
|
|
|
node-0 flush 0 0 0
|
2018-06-18 12:06:42 -04:00
|
|
|
...
|
2018-04-19 07:47:20 -04:00
|
|
|
node-0 write 0 0 0
|
2017-05-03 20:58:23 -04:00
|
|
|
--------------------------------------------------
|
2018-06-20 20:36:37 -04:00
|
|
|
// TESTRESPONSE[s/\.\.\./(node-0 \\S+ 0 0 0\n)+/]
|
2017-05-03 20:58:23 -04:00
|
|
|
// TESTRESPONSE[s/\d+/\\d+/ _cat]
|
2018-06-18 12:06:42 -04:00
|
|
|
// The substitutions do two things:
|
|
|
|
// 1. Expect any number of extra thread pools. This allows us to only list a
|
|
|
|
// few thread pools. The list would be super long otherwise. In addition,
|
|
|
|
// if xpack is installed then the list will contain more thread pools and
|
|
|
|
// this way we don't have to assert about them.
|
|
|
|
// 2. Expect any number of active, queued, or rejected items. We really don't
|
|
|
|
// know how many there will be and we just want to assert that there are
|
|
|
|
// numbers in the response, not *which* numbers are there.
|
2014-01-25 12:20:46 -05:00
|
|
|
|
2016-08-03 23:02:13 -04:00
|
|
|
The first column is the node name
|
2014-01-25 12:20:46 -05:00
|
|
|
|
2017-05-03 20:58:23 -04:00
|
|
|
[source,txt]
|
2014-01-25 12:20:46 -05:00
|
|
|
--------------------------------------------------
|
2016-08-03 23:02:13 -04:00
|
|
|
node_name
|
2017-05-03 20:58:23 -04:00
|
|
|
node-0
|
2014-01-25 12:20:46 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2016-08-03 23:02:13 -04:00
|
|
|
The second column is the thread pool name
|
2017-05-03 20:58:23 -04:00
|
|
|
[source,txt]
|
2014-01-25 12:20:46 -05:00
|
|
|
--------------------------------------------------
|
2016-08-03 23:02:13 -04:00
|
|
|
name
|
2018-04-17 06:46:15 -04:00
|
|
|
analyze
|
2018-06-20 20:36:37 -04:00
|
|
|
ccr (default distro only)
|
2016-08-03 23:02:13 -04:00
|
|
|
fetch_shard_started
|
|
|
|
fetch_shard_store
|
|
|
|
flush
|
|
|
|
force_merge
|
|
|
|
generic
|
|
|
|
get
|
|
|
|
listener
|
|
|
|
management
|
2018-06-18 12:06:42 -04:00
|
|
|
ml_autodetect (default distro only)
|
|
|
|
ml_datafeed (default distro only)
|
|
|
|
ml_utility (default distro only)
|
2016-08-03 23:02:13 -04:00
|
|
|
refresh
|
2018-06-18 12:06:42 -04:00
|
|
|
rollup_indexing (default distro only)`
|
2016-08-03 23:02:13 -04:00
|
|
|
search
|
2018-06-18 12:06:42 -04:00
|
|
|
security-token-key (default distro only)
|
2016-08-03 23:02:13 -04:00
|
|
|
snapshot
|
|
|
|
warmer
|
2018-06-18 12:06:42 -04:00
|
|
|
watcher (default distro only)
|
2018-04-19 07:47:20 -04:00
|
|
|
write
|
2014-01-25 12:20:46 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
|
|
|
|
|
2016-08-03 23:02:13 -04:00
|
|
|
The next three columns show the active, queue, and rejected statistics for each thread pool
|
2014-01-25 12:20:46 -05:00
|
|
|
|
2017-05-03 20:58:23 -04:00
|
|
|
[source,txt]
|
2014-01-25 12:20:46 -05:00
|
|
|
--------------------------------------------------
|
2016-08-03 23:02:13 -04:00
|
|
|
active queue rejected
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
2018-06-20 20:36:37 -04:00
|
|
|
0 0 0
|
2016-08-03 23:02:13 -04:00
|
|
|
1 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
|
|
|
0 0 0
|
2014-01-25 12:20:46 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
|
2016-08-03 23:02:13 -04:00
|
|
|
The cat thread pool API accepts a `thread_pool_patterns` URL parameter for specifying a
|
|
|
|
comma-separated list of regular expressions to match thread pool names.
|
2014-03-27 02:46:11 -04:00
|
|
|
|
2017-05-03 20:58:23 -04:00
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
GET /_cat/thread_pool/generic?v&h=id,name,active,rejected,completed
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
|
|
|
|
which looks like:
|
|
|
|
|
Enforce that responses in docs are valid json (#26249)
All of the snippets in our docs marked with `// TESTRESPONSE` are
checked against the response from Elasticsearch but, due to the
way they are implemented they are actually parsed as YAML instead
of JSON. Luckilly, all valid JSON is valid YAML! Unfurtunately
that means that invalid JSON has snuck into the exmples!
This adds a step during the build to parse them as JSON and fail
the build if they don't parse.
But no! It isn't quite that simple. The displayed text of some of
these responses looks like:
```
{
...
"aggregations": {
"range": {
"buckets": [
{
"to": 1.4436576E12,
"to_as_string": "10-2015",
"doc_count": 7,
"key": "*-10-2015"
},
{
"from": 1.4436576E12,
"from_as_string": "10-2015",
"doc_count": 0,
"key": "10-2015-*"
}
]
}
}
}
```
Note the `...` which isn't valid json but we like it anyway and want
it in the output. We use substitution rules to convert the `...`
into the response we expect. That yields a response that looks like:
```
{
"took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,
"aggregations": {
"range": {
"buckets": [
{
"to": 1.4436576E12,
"to_as_string": "10-2015",
"doc_count": 7,
"key": "*-10-2015"
},
{
"from": 1.4436576E12,
"from_as_string": "10-2015",
"doc_count": 0,
"key": "10-2015-*"
}
]
}
}
}
```
That is what the tests consume but it isn't valid JSON! Oh no! We don't
want to go update all the substitution rules because that'd be huge and,
ultimately, wouldn't buy much. So we quote the `$body.took` bits before
parsing the JSON.
Note the responses that we use for the `_cat` APIs are all converted into
regexes and there is no expectation that they are valid JSON.
Closes #26233
2017-08-17 09:02:10 -04:00
|
|
|
[source,txt]
|
2016-08-03 23:02:13 -04:00
|
|
|
--------------------------------------------------
|
|
|
|
id name active rejected completed
|
|
|
|
0EWUhXeBQtaVGlexUeVwMg generic 0 0 70
|
|
|
|
--------------------------------------------------
|
2017-05-03 20:58:23 -04:00
|
|
|
// TESTRESPONSE[s/0EWUhXeBQtaVGlexUeVwMg/[\\w-]+/ s/\d+/\\d+/ _cat]
|
2014-03-27 02:46:11 -04:00
|
|
|
|
2017-02-16 14:41:42 -05:00
|
|
|
Here the host columns and the active, rejected and completed suggest thread pool statistics are displayed.
|
2014-03-27 02:46:11 -04:00
|
|
|
|
2016-08-03 23:02:13 -04:00
|
|
|
All <<modules-threadpool,built-in thread pools>> and custom thread pools are available.
|
2014-03-27 02:46:11 -04:00
|
|
|
[float]
|
|
|
|
==== Thread Pool Fields
|
|
|
|
|
|
|
|
For each thread pool, you can load details about it by using the field names
|
2016-08-03 23:02:13 -04:00
|
|
|
in the table below.
|
2014-03-27 02:46:11 -04:00
|
|
|
|
|
|
|
[cols="<,<,<",options="header"]
|
|
|
|
|=======================================================================
|
|
|
|
|Field Name |Alias |Description
|
2016-08-03 23:02:13 -04:00
|
|
|
|`type` |`t` |The current (*) type of thread pool (`fixed` or `scaling`)
|
2014-03-27 02:46:11 -04:00
|
|
|
|`active` |`a` |The number of active threads in the current thread pool
|
2018-04-03 17:27:26 -04:00
|
|
|
|`pool_size` |`psz` |The number of threads in the current thread pool
|
2014-03-27 02:46:11 -04:00
|
|
|
|`queue` |`q` |The number of tasks in the queue for the current thread pool
|
2016-08-03 23:02:13 -04:00
|
|
|
|`queue_size` |`qs` |The maximum number of tasks permitted in the queue for the current thread pool
|
|
|
|
|`rejected` |`r` |The number of tasks rejected by the thread pool executor
|
2014-03-27 02:46:11 -04:00
|
|
|
|`largest` |`l` |The highest number of active threads in the current thread pool
|
2016-08-03 23:02:13 -04:00
|
|
|
|`completed` |`c` |The number of tasks completed by the thread pool executor
|
2018-04-03 17:27:26 -04:00
|
|
|
|`core` |`cr` |The configured core number of active threads allowed in the current thread pool
|
|
|
|
|`max` |`mx` |The configured maximum number of active threads allowed in the current thread pool
|
|
|
|
|`size` |`sz` |The configured fixed number of active threads allowed in the current thread pool
|
2016-08-03 23:02:13 -04:00
|
|
|
|`keep_alive` |`k` |The configured keep alive time for threads
|
2014-03-27 02:46:11 -04:00
|
|
|
|=======================================================================
|
|
|
|
|
|
|
|
[float]
|
|
|
|
=== Other Fields
|
|
|
|
|
|
|
|
In addition to details about each thread pool, it is also convenient to get an
|
2016-08-03 23:02:13 -04:00
|
|
|
understanding of where those thread pools reside. As such, you can request
|
2014-03-27 02:46:11 -04:00
|
|
|
other details like the `ip` of the responding node(s).
|
|
|
|
|
|
|
|
[cols="<,<,<",options="header"]
|
|
|
|
|=======================================================================
|
|
|
|
|Field Name |Alias |Description
|
2016-08-03 23:02:13 -04:00
|
|
|
|`node_id` |`id` |The unique node ID
|
|
|
|
|`ephemeral_id`|`eid` |The ephemeral node ID
|
2014-03-27 02:46:11 -04:00
|
|
|
|`pid` |`p` |The process ID of the running node
|
|
|
|
|`host` |`h` |The hostname for the current node
|
|
|
|
|`ip` |`i` |The IP address for the current node
|
|
|
|
|`port` |`po` |The bound transport port for the current node
|
2015-09-17 16:36:25 -04:00
|
|
|
|=======================================================================
|