Skip to content

Add adaptive execution policy#17378

Merged
tdcmeehan merged 1 commit intoprestodb:masterfrom
tdcmeehan:sch
Mar 5, 2022
Merged

Add adaptive execution policy#17378
tdcmeehan merged 1 commit intoprestodb:masterfrom
tdcmeehan:sch

Conversation

@tdcmeehan
Copy link
Copy Markdown
Contributor

@tdcmeehan tdcmeehan commented Mar 1, 2022

Add a simple adaptive execution policy that delegates to all-at-once scheduling for low stage queries, and phased scheduling for high stage queries. The aim is to keep lower stage queries at a reasonable latency, while making high stage queries more reliable at the potential cost of higher latency--reducing the maximum concurrent running task count can improve reliability in heavily loaded clusters that run very high-stage queries, as may be generated by BI tools, ETL jobs, or complex analytical queries.

Test plan - Ran this configuration with a workload that skewed toward high stage queries and observed improvement in running task count. While this test may not always reflect the real world, in reality reliability issues are typically seen when a burst of high stage queries are executed in tandem in a cluster. In other words, this change should keep typical task counts constant, but improve (lower) the running task count in the worst case where reliability issues are encountered.

ods_pxlcld_tim_meehan_2022_03_03t14_31_15_099z_

== RELEASE NOTES ==

General Changes


* Add an adaptive stage scheduling policy that switches to phased execution mode once a query's stage count exceeds a configurable upper bound. This can be enabled by setting the session property ``execution_policy`` to ``phased`` and the stage count limit can be configured by the session property ``max_stage_count_for_eager_scheduling``.

@tdcmeehan tdcmeehan force-pushed the sch branch 6 times, most recently from 24282eb to 032e093 Compare March 1, 2022 15:57
@tdcmeehan tdcmeehan requested review from a team and ajaygeorge March 3, 2022 14:05
@tdcmeehan tdcmeehan changed the title [WIP] Add adaptive execution policy Add adaptive execution policy Mar 3, 2022
@mayankgarg1990
Copy link
Copy Markdown

This looks good to me . While query latency is an acceptable impact to protect the cluster, do we expect some sort of memory impact as well ? I am not completely familiar with how phased execution is implemented, so I maybe wrong here - but since some stages might not be scheduled, we might have data staying in memory for longer and that can increase the memory-second value of a query?

@mayankgarg1990
Copy link
Copy Markdown

Add an adaptive stage scheduling policy that switches to phased execution mode once a query's stage count exceeds a configurable upper bound. This can be enabled by setting the session property ``execution_policy`` to ``phased`` and the stage count limit can be configured by the session property ``max_stage_count_for_eager_scheduling``.

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.

It make more sense to call this config Adaptive scheduling over eager scheduling. wdyt?

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.

Hmm, I'm putting "max for eager scheduling", meaning the maximum level before which we use eager scheduling, and after which we use phased scheduling.

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.

Can we add some unit test to verify this works as expected?

@tdcmeehan
Copy link
Copy Markdown
Contributor Author

This looks good to me . While query latency is an acceptable impact to protect the cluster, do we expect some sort of memory impact as well ? I am not completely familiar with how phased execution is implemented, so I maybe wrong here - but since some stages might not be scheduled, we might have data staying in memory for longer and that can increase the memory-second value of a query?

I actually think this will likely improve memory, since we won't create tasks for the entire plan for large stage queries, and task-related overhead dominates memory usage in heavily loaded clusters.

@tdcmeehan tdcmeehan requested a review from rschlussel March 3, 2022 20:05
@tdcmeehan tdcmeehan requested a review from a team March 4, 2022 19:57
@tdcmeehan tdcmeehan merged commit 5eae5e5 into prestodb:master Mar 5, 2022
@varungajjala varungajjala mentioned this pull request Mar 22, 2022
9 tasks
@asjadsyed asjadsyed mentioned this pull request Mar 23, 2022
9 tasks
@asjadsyed asjadsyed mentioned this pull request Apr 1, 2022
8 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.

5 participants