Skip to content

Allow assigning exclusive node for task execution#10432

Merged
losipiuk merged 11 commits intotrinodb:masterfrom
losipiuk:lo/retry-memory-burst
Mar 10, 2022
Merged

Allow assigning exclusive node for task execution#10432
losipiuk merged 11 commits intotrinodb:masterfrom
losipiuk:lo/retry-memory-burst

Conversation

@losipiuk
Copy link
Copy Markdown
Member

@losipiuk losipiuk commented Dec 29, 2021

Description

If the task fails due to an out-of-memory error on the next retry Trino will try to allocate the full node for execution.

General information

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)

core query engine

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

N/A

Documentation

(x) No documentation is needed. (will be added separately for whole fault-tolerance feature)
( ) 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

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

# General
* Improved handling for queries where individual tasks require lots of memory. 
  If the task fails due to out-of-memory error it is retried with a full node at its disposition.
  Mechanism is only active if task based retries are enabled (``retry-policy`` is set to ``TASK``) ({issue}`10432`)

@losipiuk
Copy link
Copy Markdown
Member Author

@arhimondr @linzebing give it some initial read when you have chance please.

@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch 3 times, most recently from afd344b to c1ddffc Compare December 31, 2021 11:04
@arhimondr arhimondr mentioned this pull request Jan 4, 2022
31 tasks
@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from c1ddffc to d9dfe98 Compare January 10, 2022 13:25
@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch 2 times, most recently from 6e8efd7 to f42b6cd Compare January 13, 2022 15:47
@losipiuk losipiuk requested a review from arhimondr January 13, 2022 15:51
@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch 3 times, most recently from 3f66f2e to 667edd4 Compare January 17, 2022 21:54
@losipiuk
Copy link
Copy Markdown
Member Author

losipiuk commented Jan 17, 2022

@arhimondr I added a way to define max number of retries per task + a simple integration test which validates that memory-burst execution actually happens.

@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from 667edd4 to 91a4f4b Compare January 21, 2022 10:16
@losipiuk losipiuk changed the title WIP: Allow assigning exclusive node for task execution Allow assigning exclusive node for task execution Jan 21, 2022
@losipiuk losipiuk marked this pull request as ready for review January 21, 2022 10:17
@losipiuk losipiuk self-assigned this Jan 21, 2022
Copy link
Copy Markdown
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.

Generally looks good to me. Great work @losipiuk .

Questions / comments are mostly minor and most of them are around configuration/naming details

@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from 91a4f4b to 178ab5d Compare January 24, 2022 12:13
@losipiuk
Copy link
Copy Markdown
Member Author

(rebased)

@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch 2 times, most recently from dc6d4d6 to 00df605 Compare January 24, 2022 23:46
@losipiuk
Copy link
Copy Markdown
Member Author

some comments remain to be addressed

@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from 00df605 to e56c891 Compare January 25, 2022 13:12
@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from d1ef1a1 to d6f53b9 Compare March 3, 2022 19:05
@losipiuk
Copy link
Copy Markdown
Member Author

losipiuk commented Mar 3, 2022

Major changes:

  • Rebased on top of Support for killing individual task if cluster is out of memory #11129.
  • Dropped mechanism of per-task memory limit. We are not enforcing limits right now. We are estimating tasks size, and bin-packing based on that, but we allow it to go above. If memory pool is exhaust memory kill will intervene and kill one of the tasks
  • I dropped integration test. With memory-killer approach I was not able to make it work (deterministically enforce that one of the tasks would require full not allocation)
  • I get workers memory from ClusterMemoryManager (not extending InternalNode with extra field).

@arhimondr PTAL once again

@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from d6f53b9 to 0cd5d69 Compare March 3, 2022 20:10
@github-actions github-actions bot added the docs label Mar 3, 2022
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we have a test covering the logic around sharedAllocatedMemory?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

what exactly you think is not covered. The testcases which allocated "shared" note exercise exactly that.

@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch 2 times, most recently from ca0b3b6 to d7e7c11 Compare March 8, 2022 15:30
@losipiuk
Copy link
Copy Markdown
Member Author

losipiuk commented Mar 8, 2022

Pushed updated version. I needed to move NodeAllocator guice bindings to CoordinatorModule as one of the implementations depends now on ClusterMemoryManager which is not bound on workers. This better place for those anyway, as we do not need NodeAllocator on workers neither.

@losipiuk losipiuk closed this Mar 8, 2022
@losipiuk losipiuk reopened this Mar 8, 2022
@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from d7e7c11 to d39e8b2 Compare March 9, 2022 12:28
losipiuk added 10 commits March 9, 2022 15:01
It turned out we do not need that functionality after all for
task-level retries. Removing as currently we do not see the benefit of the
mechanism and it increases complexity.
Different implementations of NodeAllocator require different scheme of
seleting memory requirements for a partition on retries. Commit
introduce PartitionMemoryEstimator interface and two separate
implementations.
* ConstantPartitionMemoryEstimator to be used with
  FixedCountNodeAllocator
* FallbackToFullNodePartitionMemoryEstimator to be used with
  FullNodeCapableNodeAllocator
@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from d39e8b2 to 1806e3b Compare March 9, 2022 14:08
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The target input size is set to 1GB. I wonder if it is better to set it to something higher, maybe 2 or 3 GB?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think default should be fraction on HEAP, not an absolute value. Will change that in a followup.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it still needed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope - actually tests failed because of that :)

@losipiuk losipiuk force-pushed the lo/retry-memory-burst branch from 1806e3b to cebfae3 Compare March 9, 2022 22:54
@losipiuk
Copy link
Copy Markdown
Member Author

CI: #5892

@losipiuk losipiuk merged commit 99ef4ec into trinodb:master Mar 10, 2022
@github-actions github-actions bot added this to the 374 milestone Mar 10, 2022
@mosabua
Copy link
Copy Markdown
Member

mosabua commented Mar 10, 2022

@losipiuk for the release notes text please use markdown syntax for the code highlighting .. so single ` only

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.

5 participants