Skip to content

MSQ: Consider PARTITION_STATS_MAX_BYTES in WorkerMemoryParameters. - #13274

Merged
cryptoe merged 5 commits into
apache:masterfrom
gianm:msq-psmb-wmp
Nov 7, 2022
Merged

cryptoe merged 5 commits into
apache:masterfrom
gianm:msq-psmb-wmp

Conversation

@gianm

@gianm gianm commented Oct 28, 2022

Copy link
Copy Markdown
Contributor

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.

@cryptoe cryptoe left a comment

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.

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
Copy Markdown
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
Copy Markdown
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.

@cryptoe cryptoe left a comment

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.

LGTM !! +1 after CICD

void finish()
{
if (resultKeyStatisticsCollector != null) {
resultKeyStatisticsCollector.clear();

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.

Nice catch !!

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

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.

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

@cryptoe

cryptoe commented Nov 3, 2022

Copy link
Copy Markdown
Contributor

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

@gianm

gianm commented Nov 3, 2022

Copy link
Copy Markdown
Contributor Author

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

cryptoe commented Nov 7, 2022

Copy link
Copy Markdown
Contributor

🚀

@kfaraz kfaraz added this to the 25.0 milestone Nov 22, 2022
riovic918data pushed a commit to riovic918data/druid that referenced this pull request Jun 12, 2026
…pache#13274)

* MSQ: Consider PARTITION_STATS_MAX_BYTES in WorkerMemoryParameters.

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

* Improved calculations.
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