Skip to content

Commit f6c7b9c

Browse files
committed
Expand some threadpool docs
1 parent f5e2a92 commit f6c7b9c

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,28 +74,50 @@ public class ThreadPool implements ReportingService<ThreadPoolInfo>, Scheduler,
7474
*/
7575
public static class Names {
7676
/**
77-
* All the tasks that do not relate to the purpose of one of the other thread pools should use this thread pool. Try to pick one of
78-
* the other more specific thread pools where possible.
77+
* A thread pool with a very high (but finite) maximum size for when there really is no other choice.
78+
* <p>
79+
* This pool may be used for one-off CPU-bound activities, but the maximum size is so high that it doesn't really work well to do a
80+
* lot of CPU-bound work in parallel here. Likewise you can do IO on this pool, but using it for lots of concurrent IO is likely
81+
* harmful in clusters with poor concurrent IO performance (especially if using spinning disks). Blocking on a future on this pool
82+
* risks deadlock if there's a chance that the completion of the future depends on work being done on this pool. Unfortunately
83+
* that's pretty likely in most cases because of how often this pool is used; it's really rare because of the high limit on the pool
84+
* size, but when it happens it is extremely harmful to the node.
85+
* <p>
86+
* This pool is also used for recovery-related work. The recovery subsystem bounds its own concurrency, and therefore the amount of
87+
* recovery work done on the {@code #GENERIC} pool, via {@code cluster.routing.allocation.node_concurrent_recoveries} and related
88+
* settings.
89+
* <p>
90+
* This pool does not reject any task. If you submit a task after the pool starts to shut down, it may simply never run.
7991
*/
8092
public static final String GENERIC = "generic";
93+
8194
/**
82-
* Important management tasks that keep the cluster from falling apart.
83-
* This thread pool ensures cluster coordination tasks do not get blocked by less critical tasks and can continue to make progress.
84-
* This thread pool also defaults to a single thread, reducing contention on the Coordinator mutex.
95+
* A thread pool solely for the use of the cluster coordination subsystem that relates to cluster state updates, master elections,
96+
* cluster membership and so on.
97+
* <p>
98+
* This pool defaults to a single thread to avoid contention on {@code Coordinator#mutex}.
8599
*/
86100
public static final String CLUSTER_COORDINATION = "cluster_coordination";
101+
87102
public static final String GET = "get";
88103
public static final String ANALYZE = "analyze";
89104
public static final String WRITE = "write";
90105
public static final String SEARCH = "search";
91106
public static final String SEARCH_COORDINATION = "search_coordination";
92107
public static final String AUTO_COMPLETE = "auto_complete";
93108
public static final String SEARCH_THROTTLED = "search_throttled";
109+
94110
/**
95-
* Cluster management tasks. Tasks that manage data, and tasks that report on cluster health via statistics etc.
96-
* Not a latency sensitive thread pool: some tasks may time be long-running; and the thread pool size is limited / relatively small.
111+
* A thread pool for running tasks related to cluster management, including collecting and exposing stats in APIs and certain other
112+
* internal tasks.
113+
* <p>
114+
* This pool is deliberately small in order to throttle the rate at which such tasks are executed and avoid diverting resources away
115+
* from production-critical work such as indexing and search. You may run long-running (CPU-bound or IO-bound) tasks on this pool,
116+
* but if the work relates to a REST API call then it must be cancellable in order to prevent an overexcited client from blocking or
117+
* delaying other management work.
97118
*/
98119
public static final String MANAGEMENT = "management";
120+
99121
public static final String FLUSH = "flush";
100122
public static final String REFRESH = "refresh";
101123
public static final String WARMER = "warmer";

0 commit comments

Comments
 (0)