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

MSQ: Consider PARTITION_STATS_MAX_BYTES in WorkerMemoryParameters. #13274

Merged
merged 5 commits into from
Nov 7, 2022

Conversation

gianm
Copy link
Contributor

@gianm gianm commented Oct 28, 2022

This consideration is important, because otherwise we can run out of memory due to large statistics-tracking objects.

@gianm gianm added the Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262 label Oct 28, 2022
This consideration is important, because otherwise we can run out of
memory due to large statistics-tracking objects.
Copy link
Contributor

@cryptoe cryptoe left a comment

Choose a reason for hiding this comment

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

Minor comment. LGTM otherwise.


// Need to subtract memoryForStatisticsTracking off the top, since this is reserved for statistics collection.
final long memoryForStatisticsTracking = (long) numWorkersInJvm * StageDefinition.PARTITION_STATS_MAX_BYTES;
final long memoryForBundles = (long) (maxMemoryInJvm * USABLE_MEMORY_FRACTION - memoryForStatisticsTracking);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add a > 0 check here? That way the user knows that he needs to give more memory to the task

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a reasonable error that occurs later on; see WorkerMemoryParametersTest.

Copy link
Contributor

@cryptoe cryptoe left a comment

Choose a reason for hiding this comment

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

LGTM !! +1 after CICD

@@ -216,6 +219,10 @@ void start()
*/
void finish()
{
if (resultKeyStatisticsCollector != null) {
resultKeyStatisticsCollector.clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice catch !!

)
{
final long usableMemory = (long) (maxMemoryInJvm * USABLE_MEMORY_FRACTION);
final long memoryForWorkers = (long) Math.min(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice. This is really cool and will go a long way in fixing the memory issues of sketches.

@cryptoe
Copy link
Contributor

cryptoe commented Nov 3, 2022

We might have to update this line Each sketch uses at most approximately 300 MB in [docs/multi-stage-query/concepts.md]

@gianm
Copy link
Contributor Author

gianm commented Nov 3, 2022

Pushed an update fixing merge conflicts, updating docs/multi-stage-query/concepts.md, and adjusting logic so the accounting for lookups happens on both controller and worker.

@cryptoe cryptoe merged commit 9423aa9 into apache:master Nov 7, 2022
@cryptoe
Copy link
Contributor

cryptoe commented Nov 7, 2022

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area - MSQ For multi stage queries - https://github.com/apache/druid/issues/12262
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants