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

[CH] Adaptive sort memory controll and support memory sort shuffle #5893

Merged
merged 9 commits into from
May 30, 2024

Conversation

liuneng1994
Copy link
Contributor

@liuneng1994 liuneng1994 commented May 28, 2024

What changes were proposed in this pull request?

优化了排序阶段的spill机制,并且根据spark task的offheap内存配置自动调整相关参数,保证在高列数(>300)的情况下稳定运行。目前能够稳定运行 300列,300+GB高压缩比 parquet分区表导入任务,不需要额外配置参数。
实现了新的排序shuffle机制,降低了排序过程中的合并开销,同时在celeborn下不再需要数据落盘。

新增加shuffle算法的切换逻辑,当列数超过一定数量,或者分区数超过300时,切换为MemorySortShuffle

How was this patch tested?

unit tests

(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)

Copy link

Thanks for opening a pull request!

Could you open an issue for this pull request on Github Issues?

https://github.com/apache/incubator-gluten/issues

Then could you also rename commit message and pull request title in the following format?

[GLUTEN-${ISSUES_ID}][COMPONENT]feat/fix: ${detailed message}

See also:

Copy link

Run Gluten Clickhouse CI

@liuneng1994 liuneng1994 force-pushed the adaptive-memory-controll branch from c32ce51 to cf82dbf Compare May 28, 2024 09:18
Copy link

Run Gluten Clickhouse CI

1 similar comment
Copy link

Run Gluten Clickhouse CI

if (!backend_conf_map.contains(CH_RUNTIME_SETTINGS_PREFIX + "prefer_external_sort_block_bytes"))
{
auto mem_gb = task_memory / static_cast<double>(1_GiB);
// 2.8x+5, Heuristics calculate the block size of external sort, [8,16]
Copy link
Contributor

@zhanglistar zhanglistar May 29, 2024

Choose a reason for hiding this comment

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

Just curious, how to get this formula?

Copy link
Contributor Author

@liuneng1994 liuneng1994 May 29, 2024

Choose a reason for hiding this comment

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

大概定了一下 1G 8M 2G 10M 3G 14M 4G 16M四个数据点然后做了一个线性回归,数据点是跟据测试效果大致选择的

Copy link

Run Gluten Clickhouse CI

@baibaichen baibaichen force-pushed the adaptive-memory-controll branch from a546bbe to ca29456 Compare May 29, 2024 10:32
Copy link

Run Gluten Clickhouse CI

Copy link
Contributor

@baibaichen baibaichen left a comment

Choose a reason for hiding this comment

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

LGTM

@liuneng1994 liuneng1994 reopened this May 30, 2024
Copy link

Run Gluten Clickhouse CI

@liuneng1994 liuneng1994 force-pushed the adaptive-memory-controll branch from ca29456 to ec11bdc Compare May 30, 2024 02:17
Copy link

Run Gluten Clickhouse CI

@baibaichen baibaichen merged commit d35d1dc into apache:main May 30, 2024
40 checks passed
@GlutenPerfBot
Copy link
Contributor

===== Performance report for TPCH SF2000 with Velox backend, for reference only ====

query log/native_5893_time.csv log/native_master_05_29_2024_588faae35_time.csv difference percentage
q1 35.86 33.56 -2.303 93.58%
q2 24.15 23.85 -0.301 98.75%
q3 38.94 37.37 -1.565 95.98%
q4 31.11 32.42 1.311 104.21%
q5 69.37 69.83 0.463 100.67%
q6 7.55 7.54 -0.008 99.90%
q7 85.36 81.75 -3.603 95.78%
q8 85.51 86.57 1.052 101.23%
q9 119.92 118.35 -1.574 98.69%
q10 45.49 44.16 -1.330 97.08%
q11 20.66 22.23 1.567 107.59%
q12 27.24 26.72 -0.517 98.10%
q13 54.96 53.60 -1.356 97.53%
q14 21.72 17.59 -4.128 80.99%
q15 29.32 32.89 3.573 112.19%
q16 14.20 13.41 -0.797 94.39%
q17 102.99 103.62 0.633 100.61%
q18 147.18 144.53 -2.646 98.20%
q19 13.61 13.59 -0.023 99.83%
q20 30.06 29.66 -0.408 98.64%
q21 265.91 260.43 -5.486 97.94%
q22 12.05 13.84 1.788 114.84%
total 1283.16 1267.50 -15.658 98.78%

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