Skip to content
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

feat: Add priority based memory reclaim framework #11598

Closed
wants to merge 1 commit into from

Conversation

tanjialiang
Copy link
Contributor

@tanjialiang tanjialiang commented Nov 19, 2024

  • Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware.
  • Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 19, 2024
Copy link

netlify bot commented Nov 19, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit f89c432
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67527439a9d2360008ff954b

@tanjialiang tanjialiang marked this pull request as ready for review November 20, 2024 21:54
@facebook-github-bot
Copy link
Contributor

@tanjialiang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@tanjialiang tanjialiang force-pushed the pri_reclaim branch 2 times, most recently from d5693b4 to e352ec7 Compare November 25, 2024 20:23
Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@tanjialiang LGTM % minors. Thanks!

velox/exec/HashJoinBridge.h Outdated Show resolved Hide resolved
velox/common/memory/MemoryArbitrator.cpp Outdated Show resolved Hide resolved
velox/connectors/hive/HiveDataSink.h Outdated Show resolved Hide resolved
velox/common/memory/MemoryArbitrator.cpp Show resolved Hide resolved
velox/exec/Task.h Outdated Show resolved Hide resolved
velox/exec/Task.h Outdated Show resolved Hide resolved
if (candidate.reclaimableBytes == 0) {
continue;
uint64_t reclaimedBytes{0};
for (uint32_t i = 0, j = i; i < candidates.size(); i = j) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we need to handle priority in parallel memory reclaimer? thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, we don't need to. They all run at once.

@tanjialiang tanjialiang force-pushed the pri_reclaim branch 7 times, most recently from d65eaf7 to beec9aa Compare December 3, 2024 17:17
@facebook-github-bot
Copy link
Contributor

@tanjialiang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@xiaoxmeng xiaoxmeng left a comment

Choose a reason for hiding this comment

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

@tanjialiang thanks for the update % minors.

@@ -174,9 +174,10 @@ bool isLeftNullAwareJoinWithFilter(
class HashJoinMemoryReclaimer final : public MemoryReclaimer {
public:
static std::unique_ptr<memory::MemoryReclaimer> create(
std::shared_ptr<HashJoinBridge> joinBridge) {
std::shared_ptr<HashJoinBridge> joinBridge,
int32_t priority = 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we enforce a priority input later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah we can probably enforce that later. But now we don't want to enforce as the current priority setting is on Task level.

@@ -69,14 +69,17 @@ class Task : public std::enable_shared_from_this<Task> {
/// thread are passed on to a separate consumer.
/// @param onError Optional callback to receive an exception if task
/// execution fails.
/// @param memoryArbitrationPriority Optional priority on task that, in a
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's be specific for memory arbitration for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 3, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 3, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 3, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 3, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 4, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 4, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 4, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 5, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/velox-1 that referenced this pull request Dec 6, 2024
…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

…11598)

Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.


Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D66261340

tanjialiang added a commit to tanjialiang/nimble that referenced this pull request Dec 6, 2024
Summary:
* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware. 
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.

X-link: facebookincubator/velox#11598

Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang
facebook-github-bot pushed a commit to facebookincubator/nimble that referenced this pull request Dec 6, 2024
Summary:
Pull Request resolved: #111

* Adds priority base reclaiming to memory reclaim framework. The priority determines which memory pool to reclaim first on the same level. This would help to make reclaim more application logic aware.
* Make join node reclaim priority lower than others. This is because cost of reclaiming (spilling) on join node is high compared to other nodes.

X-link: facebookincubator/velox#11598

Reviewed By: xiaoxmeng

Differential Revision: D66261340

Pulled By: tanjialiang

fbshipit-source-id: c03b2ef25b39dc8771f66321731d5a88da26638e
@facebook-github-bot
Copy link
Contributor

@tanjialiang merged this pull request in 939c102.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants