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

[native]Update Prestissimo to report the actual used task memory #22833

Merged
merged 1 commit into from
May 29, 2024

Conversation

xiaoxmeng
Copy link
Contributor

@xiaoxmeng xiaoxmeng commented May 24, 2024

Changes to report the cumulative bytes using usedBytes from non-leaf pool instead of
reserved bytes so as to track the actual memory usage better.

tanjialiang
tanjialiang previously approved these changes May 28, 2024
Copy link
Contributor

@tanjialiang tanjialiang left a comment

Choose a reason for hiding this comment

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

Thanks

@@ -654,8 +654,8 @@ TEST_P(PrestoExchangeSourceTest, slowProducer) {
auto queue = makeSingleSourceQueue();
auto exchangeSource = makeExchangeSource(producerAddress, useHttps, 3, queue);

size_t beforePoolSize = pool_->currentBytes();
size_t beforeQueueSize = queue->totalBytes();
const size_t beforePoolSize = pool_->usedBytes();
Copy link
Contributor

Choose a reason for hiding this comment

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

const auto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

why auto here?

size_t beforePoolSize = pool_->currentBytes();
size_t beforeQueueSize = queue->totalBytes();
const size_t beforePoolSize = pool_->usedBytes();
const size_t beforeQueueSize = queue->totalBytes();
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

size_t deltaPool = pool_->currentBytes() - beforePoolSize;
size_t deltaQueue = queue->totalBytes() - beforeQueueSize;
EXPECT_EQ(deltaPool, deltaQueue);
const size_t deltaPoolBytes = pool_->usedBytes() - beforePoolSize;
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor

@amitkdutta amitkdutta left a comment

Choose a reason for hiding this comment

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

Looks good from my end. @tanjialiang pleast take another look if auto is a blocker. Otherwise lets accept and land it.

tanjialiang
tanjialiang previously approved these changes May 29, 2024
Copy link
Contributor

@spershin spershin left a comment

Choose a reason for hiding this comment

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

@xiaoxmeng
Thank you for the change!

Let's update the PR description to explain what we are trying to achieve.
Also, left few questions, because it is not clear why we making these changes.

Comment on lines +550 to +551
const auto currentBytes = task->pool()->usedBytes();
prestoTaskStats.userMemoryReservationInBytes = currentBytes;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we get 'currentBytes' from 'veloxTaskMemStats'?
they are both received from the pool.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

stats() still use currentBytes(), and I will switch to use usedBytes in stats() after deprecate currentBytes.

@@ -1199,7 +1199,7 @@ protocol::NodeStatus PrestoServer::fetchNodeStatus() {
(int)std::thread::hardware_concurrency(),
cpuLoadPct,
cpuLoadPct,
pool_ ? pool_->currentBytes() : 0,
pool_ ? pool_->usedBytes() : 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the diff between currentBytes and usedBytes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

currentBytes is deprecated. I will remove from velox later.

presto-native-execution/presto_cpp/main/PrestoServer.cpp Outdated Show resolved Hide resolved
Changes to report the cumulative bytes using usedBytes from non-leaf pool instead of
reserved bytes so as to track the actual memory usage better.
@xiaoxmeng xiaoxmeng merged commit 0a40a0b into prestodb:master May 29, 2024
59 checks passed
@xiaoxmeng xiaoxmeng deleted the advance branch May 29, 2024 18:45
@wanglinsong wanglinsong mentioned this pull request Jun 25, 2024
36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants