|
1 | 1 | [[task-queue-backlog]]
|
2 | 2 | === Task queue backlog
|
3 | 3 |
|
4 |
| -A backlogged task queue can prevent tasks from completing and |
5 |
| -put the cluster into an unhealthy state. |
6 |
| -Resource constraints, a large number of tasks being triggered at once, |
7 |
| -and long running tasks can all contribute to a backlogged task queue. |
| 4 | +A backlogged task queue can prevent tasks from completing and put the cluster |
| 5 | +into an unhealthy state. Resource constraints, a large number of tasks being |
| 6 | +triggered at once, and long running tasks can all contribute to a backlogged |
| 7 | +task queue. |
8 | 8 |
|
9 | 9 | [discrete]
|
10 | 10 | [[diagnose-task-queue-backlog]]
|
11 | 11 | ==== Diagnose a task queue backlog
|
12 | 12 |
|
13 | 13 | **Check the thread pool status**
|
14 | 14 |
|
15 |
| -A <<high-cpu-usage,depleted thread pool>> can result in <<rejected-requests,rejected requests>>. |
| 15 | +A <<high-cpu-usage,depleted thread pool>> can result in |
| 16 | +<<rejected-requests,rejected requests>>. |
16 | 17 |
|
17 |
| -You can use the <<cat-thread-pool,cat thread pool API>> to |
18 |
| -see the number of active threads in each thread pool and |
19 |
| -how many tasks are queued, how many have been rejected, and how many have completed. |
| 18 | +Thread pool depletion might be restricted to a specific <<data-tiers,data tier>>. If <<hotspotting,hot spotting>> is occuring, one node might experience depletion faster than other nodes, leading to performance issues and a growing task backlog. |
| 19 | + |
| 20 | +You can use the <<cat-thread-pool,cat thread pool API>> to see the number of |
| 21 | +active threads in each thread pool and how many tasks are queued, how many |
| 22 | +have been rejected, and how many have completed. |
20 | 23 |
|
21 | 24 | [source,console]
|
22 | 25 | ----
|
23 | 26 | GET /_cat/thread_pool?v&s=t,n&h=type,name,node_name,active,queue,rejected,completed
|
24 | 27 | ----
|
25 | 28 |
|
| 29 | +The `active` and `queue` statistics are instantaneous while the `rejected` and |
| 30 | +`completed` statistics are cumulative from node startup. |
| 31 | + |
26 | 32 | **Inspect the hot threads on each node**
|
27 | 33 |
|
28 |
| -If a particular thread pool queue is backed up, |
29 |
| -you can periodically poll the <<cluster-nodes-hot-threads,Nodes hot threads>> API |
30 |
| -to determine if the thread has sufficient |
31 |
| -resources to progress and gauge how quickly it is progressing. |
| 34 | +If a particular thread pool queue is backed up, you can periodically poll the |
| 35 | +<<cluster-nodes-hot-threads,Nodes hot threads>> API to determine if the thread |
| 36 | +has sufficient resources to progress and gauge how quickly it is progressing. |
32 | 37 |
|
33 | 38 | [source,console]
|
34 | 39 | ----
|
35 | 40 | GET /_nodes/hot_threads
|
36 | 41 | ----
|
37 | 42 |
|
38 |
| -**Look for long running tasks** |
| 43 | +**Look for long running node tasks** |
| 44 | + |
| 45 | +Long-running tasks can also cause a backlog. You can use the <<tasks,task |
| 46 | +management>> API to get information about the node tasks that are running. |
| 47 | +Check the `running_time_in_nanos` to identify tasks that are taking an |
| 48 | +excessive amount of time to complete. |
| 49 | + |
| 50 | +[source,console] |
| 51 | +---- |
| 52 | +GET /_tasks?pretty=true&human=true&detailed=true |
| 53 | +---- |
39 | 54 |
|
40 |
| -Long-running tasks can also cause a backlog. |
41 |
| -You can use the <<tasks,task management>> API to get information about the tasks that are running. |
42 |
| -Check the `running_time_in_nanos` to identify tasks that are taking an excessive amount of time to complete. |
| 55 | +If a particular `action` is suspected, you can filter the tasks further. The most common long-running tasks are <<docs-bulk,bulk index>>- or search-related. |
43 | 56 |
|
| 57 | +* Filter for <<docs-bulk,bulk index>> actions: |
| 58 | ++ |
44 | 59 | [source,console]
|
45 | 60 | ----
|
46 |
| -GET /_tasks?filter_path=nodes.*.tasks |
| 61 | +GET /_tasks?human&detailed&actions=indices:data/write/bulk |
| 62 | +---- |
| 63 | + |
| 64 | +* Filter for search actions: |
| 65 | ++ |
| 66 | +[source,console] |
47 | 67 | ----
|
| 68 | +GET /_tasks?human&detailed&actions=indices:data/write/search |
| 69 | +---- |
| 70 | + |
| 71 | +The API response may contain additional tasks columns, including `description` and `header`, which provides the task parameters, target, and requestor. You can use this information to perform further diagnosis. |
| 72 | + |
| 73 | +**Look for long running cluster tasks** |
| 74 | + |
| 75 | +A task backlog might also appear as a delay in synchronizing the cluster state. You |
| 76 | +can use the <<cluster-pending,cluster pending tasks API>> to get information |
| 77 | +about the pending cluster state sync tasks that are running. |
| 78 | + |
| 79 | +[source,console] |
| 80 | +---- |
| 81 | +GET /_cluster/pending_tasks |
| 82 | +---- |
| 83 | + |
| 84 | +Check the `timeInQueue` to identify tasks that are taking an excessive amount |
| 85 | +of time to complete. |
48 | 86 |
|
49 | 87 | [discrete]
|
50 | 88 | [[resolve-task-queue-backlog]]
|
|
0 commit comments