Skip to content

Conversation

@DaveCTurner
Copy link
Contributor

These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.
@DaveCTurner DaveCTurner added >bug :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) v8.18.1 v8.19.0 v9.0.1 v9.1.0 v8.17.3 labels Feb 24, 2025
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Coordination Meta label for Distributed Coordination team label Feb 24, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed-coordination (Team:Distributed Coordination)

@elasticsearchmachine
Copy link
Collaborator

Hi @DaveCTurner, I've created a changelog YAML for you.

Copy link
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks just fine except I think we need to change where we fork still?

actionFilters,
TransportGetAllocationStatsAction.Request::new,
TransportGetAllocationStatsAction.Response::new,
threadPool.executor(ThreadPool.Names.MANAGEMENT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wouldn't want to fork anymore with the deduplicator would you? Only fork in case you actually do the computation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically yes that's right of course. I'm always in two minds about adding more non-forking actions: they increase the risk of serious pain in future (for nontechnical reasons) at the cost of a little more latency right now. I'll let you have this one without prejudice tho 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd think forking lowers the risk of pain the future, but under load already are at the other end of this.
Forking is far more expensive than just the fork in the real world. You also need to account for the fact that you'll allocate a buffer off of the channel's thread and release that buffer which comes with contention very quickly unfortunately. Just to illustrate this a little :)

image

Copy link
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks!

final var startBarrier = new CyclicBarrier(threads.length);
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread(() -> {
safeAwait(startBarrier);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: could use org.elasticsearch.test.ESTestCase#startInParallel here ? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cute TIL

@DaveCTurner DaveCTurner added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) auto-backport Automatically create backport pull requests when merged v8.16.5 labels Feb 24, 2025
@elasticsearchmachine elasticsearchmachine merged commit 187b192 into elastic:main Feb 24, 2025
17 checks passed
@DaveCTurner DaveCTurner deleted the 2025/02/24/deduplicate-allocation-stats branch February 24, 2025 13:21
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.18 Commit could not be cherrypicked due to conflicts
8.x Commit could not be cherrypicked due to conflicts
9.0
8.16 Commit could not be cherrypicked due to conflicts
8.17 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 123246

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

Backport of elastic#123246 to `8.x`
@DaveCTurner
Copy link
Contributor Author

8.x-and-earlier backports are #123267

elasticsearchmachine pushed a commit that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.
elasticsearchmachine pushed a commit that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

Backport of #123246 to `8.x`
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

Backport of elastic#123246 to `8.x`
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

Backport of elastic#123246 to `8.x`
DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

Backport of elastic#123246 to `8.x`
elasticsearchmachine pushed a commit that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

Backport of #123246 to `8.x`
elasticsearchmachine pushed a commit that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

Backport of #123246 to `8.x`
elasticsearchmachine pushed a commit that referenced this pull request Feb 24, 2025
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.

Backport of #123246 to `8.x`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >bug :Distributed Coordination/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) Team:Distributed Coordination Meta label for Distributed Coordination team v8.16.5 v8.17.3 v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants