-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Expand some threadpool docs #123244
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
Expand some threadpool docs #123244
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
DiannaHohensee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This improvement lead me to a lot of further questions 😅
server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/threadpool/ThreadPool.java
Outdated
Show resolved
Hide resolved
DiannaHohensee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Some comments remain, but they're minor. Looks nice.
| * performance (especially if using spinning disks). | ||
| * <p> | ||
| * Blocking on a future on this pool risks deadlock if there's a chance that the completion of the future depends on work being done | ||
| * on this pool. Unfortunately that's pretty likely in most cases because of how often this pool is used; it's really rare because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This made me wonder about the details of how a deadlock could occur, so that one can avoid it properly. Seemed to suggest Executor tasks are executed in order, of submission perhaps, so I was thinking maybe a task waiting for the future is put on the queue first. But that would mean a caller queues the future task before the task that it waits on. Is that really the scenario, or is there something else at play?
In short, if you could elaborate on the particulars of how the deadlock can happen, that would help readers not to do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think execution order matters (although yes the queue is FIFO). It's just what it says: blocking generic threads on futures risks deadlock if the completion of those futures requires work to be done on the generic pool. There's no way to do that work if all the threads that could do it are blocked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for referencing UnsafePlainActionFuture 👍
| * on this pool. Unfortunately 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 size, but when it happens it is extremely harmful to the node. | ||
| * <p> | ||
| * This pool is for instance used for recovery-related work, which is a mix of CPU-bound and IO-bound work. The recovery subsystem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd bump this paragraph higher, swap it with the above deadlock paragraph. It looks like a natural continuation of the CPU/IO paragraphs discussions, and deadlocking doesn't participate in that line of reasoning (but currently interrupts it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it where it is but clarified that recovery also doesn't block on futures, so this now follows more logically from the preceding paragraphs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good 👍
DiannaHohensee
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍
No description provided.