Skip to content

Evenly distribute exchange spooling data across different shards#11987

Merged
arhimondr merged 3 commits intotrinodb:masterfrom
linzebing:multiple-s3-buckets
Apr 20, 2022
Merged

Evenly distribute exchange spooling data across different shards#11987
arhimondr merged 3 commits intotrinodb:masterfrom
linzebing:multiple-s3-buckets

Conversation

@linzebing
Copy link
Member

@linzebing linzebing commented Apr 16, 2022

Description

Is this change a fix, improvement, new feature, refactoring, or other?

Improvement.

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

trino-exchange

How would you describe this change to a non-technical end user or system administrator?

Sometimes we run into cases where we get throttled by S3.

  1. Supporting multiple buckets as exchange spooling destinations will distribute the requests to get around the throttling limits. Currently, data of different taskPartitions gets assigned to these buckets in a round-robin fashion.
  2. Adding a random prefix to sink output path. Data output file path format: {randomizedPrefix}.{queryId}.{stageId}.{sinkPartitionId}/{attemptId}/{sourcePartitionId}_{splitId}.data

Related issues, pull requests, and links

Documentation

() No documentation is needed.
(x) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

(x) No release notes entries required.
( ) Release notes entries required with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Apr 16, 2022
@linzebing linzebing changed the title Support exchange spooling on multiple buckets [WIP] Support exchange spooling on multiple buckets Apr 16, 2022
@linzebing linzebing changed the title [WIP] Support exchange spooling on multiple buckets Support exchange spooling on multiple buckets Apr 16, 2022
@linzebing linzebing requested review from arhimondr and losipiuk April 16, 2022 23:36
Copy link
Contributor

@arhimondr arhimondr left a comment

Choose a reason for hiding this comment

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

LGTM % comments

@linzebing linzebing force-pushed the multiple-s3-buckets branch from eeeeb2c to bf7f12f Compare April 18, 2022 18:30
@github-actions github-actions bot added the docs label Apr 18, 2022
@linzebing linzebing force-pushed the multiple-s3-buckets branch from bf7f12f to e757d1f Compare April 18, 2022 21:13
@linzebing linzebing changed the title Support exchange spooling on multiple buckets Evenly distribute exchange spooling data across different shards Apr 18, 2022
@linzebing linzebing force-pushed the multiple-s3-buckets branch 2 times, most recently from bfff687 to c7223b5 Compare April 18, 2022 21:52
Copy link
Member

Choose a reason for hiding this comment

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

nit: passing i as taskPartitionId is somewhat ugly, and exploits the implementation details of getExchangeDirectory (that it uses partitionId modulo number of base directories to determine final directory shape).
A cleaner approach would be to have explicitly method List<URI> getAllExchangeDirectories() and use it in close and in initialize

Copy link
Member Author

Choose a reason for hiding this comment

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

With the last commit, this part has been changed to delete all task output directories. I will create a follow up PR to delete the directories in batches.

@linzebing linzebing force-pushed the multiple-s3-buckets branch 2 times, most recently from 7f393c6 to dda1610 Compare April 19, 2022 20:38
Add a randomized prefix to evenly distribute data into different S3 shards. Data output file path format: {randomizedPrefix}.{queryId}.{stageId}.{sinkPartitionId}/{attemptId}/{sourcePartitionId}_{splitId}.data
@linzebing linzebing force-pushed the multiple-s3-buckets branch from dda1610 to 8c6a4c1 Compare April 19, 2022 21:59
@arhimondr arhimondr merged commit 85e6ce2 into trinodb:master Apr 20, 2022
@github-actions github-actions bot added this to the 378 milestone Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants