2014-01-25 12:20:46 -05:00
|
|
|
[[cat-thread-pool]]
|
2019-08-13 08:35:08 -04:00
|
|
|
=== cat thread pool API
|
|
|
|
++++
|
|
|
|
<titleabbrev>cat thread pool</titleabbrev>
|
|
|
|
++++
|
2014-01-25 12:20:46 -05:00
|
|
|
|
2019-08-12 08:36:36 -04:00
|
|
|
Returns thread pool statistics for each node in a cluster. Returned information
|
|
|
|
includes all <<modules-threadpool,built-in thread pools>> and custom thread
|
|
|
|
pools.
|
|
|
|
|
|
|
|
|
|
|
|
[[cat-thread-pool-api-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
`GET /_cat/thread_pool/{thread_pool}`
|
|
|
|
|
|
|
|
[[cat-thread-pool-path-params]]
|
|
|
|
==== {api-path-parms-title}
|
|
|
|
|
|
|
|
`{thread_pool}`::
|
|
|
|
(Optional, string) Comma-separated list of thread pool names used to limit the
|
|
|
|
request. Accepts wildcard expressions.
|
|
|
|
|
|
|
|
|
|
|
|
[[cat-thread-pool-query-params]]
|
|
|
|
==== {api-query-parms-title}
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=http-format]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-h]
|
|
|
|
+
|
|
|
|
--
|
|
|
|
If you do not specify which columns to include, the API returns the default
|
|
|
|
columns in the order listed below. If you explicitly specify one or more
|
|
|
|
columns, it only returns the specified columns.
|
|
|
|
|
|
|
|
Valid columns are:
|
|
|
|
|
|
|
|
`node_name`::
|
|
|
|
(Default) Node name, such as `I8hydUG`.
|
|
|
|
|
|
|
|
`name`::
|
|
|
|
(Default) Name of the thread pool, such as `analyze` or `generic`.
|
|
|
|
|
|
|
|
`active`, `a`::
|
|
|
|
(Default) Number of active threads in the current thread pool.
|
|
|
|
|
|
|
|
`queue`,`q`::
|
|
|
|
(Default) Number of tasks in the queue for the current thread pool.
|
|
|
|
|
|
|
|
`rejected`, `r`::
|
|
|
|
(Default) Number of tasks rejected by the thread pool executor.
|
|
|
|
|
|
|
|
`completed`, `c`::
|
|
|
|
Number of tasks completed by the thread pool executor.
|
|
|
|
|
|
|
|
`core`, `cr`::
|
|
|
|
Configured core number of active threads allowed in the current thread pool.
|
|
|
|
|
|
|
|
`ephemeral_id`,`eid`::
|
|
|
|
Ephemeral node ID.
|
|
|
|
|
|
|
|
`host`, `h`::
|
|
|
|
Hostname for the current node.
|
|
|
|
|
|
|
|
`ip`, `i`::
|
|
|
|
IP address for the current node.
|
|
|
|
|
|
|
|
`keep_alive`, `k`::
|
|
|
|
Configured keep alive time for threads.
|
|
|
|
|
|
|
|
`largest`, `l`::
|
|
|
|
Highest number of active threads in the current thread pool.
|
|
|
|
|
|
|
|
`max`, `mx`::
|
|
|
|
Configured maximum number of active threads allowed in the current thread pool.
|
|
|
|
|
|
|
|
`node_id`, `id`::
|
|
|
|
ID of the node, such as `k0zy`.
|
|
|
|
|
|
|
|
`pid`, `p`::
|
|
|
|
Process ID of the running node.
|
|
|
|
|
|
|
|
`pool_size`, `psz`::
|
|
|
|
Number of threads in the current thread pool.
|
|
|
|
|
|
|
|
`port`, `po`::
|
|
|
|
Bound transport port for the current node.
|
|
|
|
|
|
|
|
`queue_size`, `qs`::
|
|
|
|
Maximum number of tasks permitted in the queue for the current thread pool.
|
|
|
|
|
|
|
|
`size`, `sz`::
|
|
|
|
Configured fixed number of active threads allowed in the current thread pool.
|
|
|
|
|
|
|
|
`type`, `t`::
|
|
|
|
Type of thread pool. Returned values are `fixed` or `scaling`.
|
|
|
|
|
|
|
|
--
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=help]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=local]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=master-timeout]
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-s]
|
|
|
|
|
|
|
|
`size`::
|
|
|
|
(Optional, <<size-units, size unit>>) Multiplier used to display quantities.
|
|
|
|
|
|
|
|
include::{docdir}/rest-api/common-parms.asciidoc[tag=cat-v]
|
|
|
|
|
|
|
|
|
|
|
|
[[cat-thread-pool-api-example]]
|
|
|
|
==== {api-examples-title}
|
|
|
|
|
|
|
|
[[cat-thread-pool-api-ex-default]]
|
|
|
|
===== Example with default columns
|
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
|
|
|
|
|
2019-08-12 08:36:36 -04:00
|
|
|
The API returns the following response:
|
2017-05-03 20:58:23 -04:00
|
|
|
|
|
|
|
[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-08-27 18:33:57 -04:00
|
|
|
// TESTRESPONSE[s/\.\.\./(node-0 \\S+ 0 0 0\n)*/]
|
2019-06-10 09:33:32 -04:00
|
|
|
// TESTRESPONSE[s/\d+/\\d+/ non_json]
|
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
|
|
|
|
|
|
|
|
2019-08-12 08:36:36 -04:00
|
|
|
[[cat-thread-pool-api-ex-headings]]
|
|
|
|
===== Example with explicit columns
|
2014-01-25 12:20:46 -05:00
|
|
|
|
2019-08-12 08:36:36 -04:00
|
|
|
The following API request returns the `id`, `name`, `active`, `rejected`, and
|
|
|
|
`completed` columns. The request limits returned information to the `generic`
|
|
|
|
thread pool.
|
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
|
|
|
|
|
2019-08-12 08:36:36 -04:00
|
|
|
The API returns the following response:
|
2017-05-03 20:58:23 -04:00
|
|
|
|
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
|
|
|
|
--------------------------------------------------
|
2019-06-10 09:33:32 -04:00
|
|
|
// TESTRESPONSE[s/0EWUhXeBQtaVGlexUeVwMg/[\\w-]+/ s/\d+/\\d+/ non_json]
|
2014-03-27 02:46:11 -04:00
|
|
|
|