Repository navigation
[CH] Refactor off heap memory management, clean shuffle write code - #6558
Conversation
|
Thanks for opening a pull request! Could you open an issue for this pull request on Github Issues? Then could you also rename commit message and pull request title in the following format? See also: |
|
Run Gluten Clickhouse CI |
63f47c0 to
b9dc0a0
Compare
|
Run Gluten Clickhouse CI |
b9dc0a0 to
2f69cba
Compare
|
Run Gluten Clickhouse CI |
|
Run Gluten Clickhouse CI |
edc79e1 to
4ef241d
Compare
|
Run Gluten Clickhouse CI |
4ef241d to
04bf0cd
Compare
|
Run Gluten Clickhouse CI |
04bf0cd to
c0bd70e
Compare
|
Run Gluten Clickhouse CI |
2 similar comments
|
Run Gluten Clickhouse CI |
|
Run Gluten Clickhouse CI |
bdf0116 to
04c8ec6
Compare
|
Run Gluten Clickhouse CI |
1 similar comment
|
Run Gluten Clickhouse CI |
bc8b2d1 to
a94d045
Compare
|
Run Gluten Clickhouse CI |
a94d045 to
b117819
Compare
|
Run Gluten Clickhouse CI |
b117819 to
48653d8
Compare
|
Run Gluten Clickhouse CI |
48653d8 to
32ceddd
Compare
|
Run Gluten Clickhouse CI |
32ceddd to
a4f9ca6
Compare
|
Run Gluten Clickhouse CI |
a4f9ca6 to
aabc77d
Compare
|
Run Gluten Clickhouse CI |
aabc77d to
afc5ba0
Compare
|
Run Gluten Clickhouse CI |
1 similar comment
|
Run Gluten Clickhouse CI |
77751d5 to
351142e
Compare
|
Run Gluten Clickhouse CI |
…e some useless configurations
351142e to
e1b197e
Compare
|
Run Gluten Clickhouse CI |
| }; | ||
|
|
||
| std::unordered_map<int64_t, std::shared_ptr<QueryContext>> query_map; | ||
| std::mutex query_map_mutex; |
There was a problem hiding this comment.
应该需要,这里会有多个task并发初始化和释放的情况,在一些频繁调用的接口,例如currentMemoryUsage上是不需要锁的,总的来说应该不会造成影响。
| if (logger->information()) | ||
| { | ||
| throw DB::Exception(ErrorCodes::LOGICAL_ERROR, "allocator {} not found", allocator_id); | ||
| std::ostringstream msg; |
There was a problem hiding this comment.
ostringstream is not recommended in CH
There was a problem hiding this comment.
这里主要是需要利用到setw 和 setfill来实现一个输出内容的对齐,提高可读性。没有找到其他更好的方式
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20240730) * Fix build due to ClickHouse/ClickHouse#65414 * FIXME: very slow after #6558 --------- Co-authored-by: kyligence-git <[email protected]> Co-authored-by: Chang Chen <[email protected]>
* [GLUTEN-1632][CH]Daily Update Clickhouse Version (20240803) * fix build due to ClickHouse/ClickHouse#65751 * Fix build due to #6558 --------- Co-authored-by: kyligence-git <[email protected]> Co-authored-by: Chang Chen <[email protected]>
What changes were proposed in this pull request?
将现有的通过spark管理内存并触发spill的机制改为由ClickHouse托管。shuffle spill触发由当前内存使用量和固定阈值决定。
修改原因:
在task线程初始化时创建对应的ThreadGroup,将task线程 attach至thread group,使得在task线程创建的pipeline executor也会加入到当前的thread group。通过thread Group的内存统计来控制整个task所需的offheap内存。
在task结束时,清理相应的thread group,并更新spark统计信息.
删除多余的配置项
不再需要选择不同的模式,保留preferSpill=false的模式,对celeborn没有影响
offheap内存管理切换至clickhouse MemoryTracker,不在需要该配置
保留flushBlockBufferBeforeEvict=true的行为,移除配置项
移除冗余的external sort shuffle 及配置
新增配置
shuffle spill触发控制,默认当前task内存使用量超过90%时触发
为task内存增加额外的hard limit限制,单位为byte,当task内存使用超过hardlimit时会产生异常。如果希望task能适度超过offheap配置可增大该配置项
内存的hard_limit = soft_limit + extra_memory_hard_limit, soft_limit为spark配置的offheap size。
依然可以通过spark ui查看task的peak memory信息

新增performance counter 日志输出,方便对task进行性能分析。

How was this patch tested?
unit tests
(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)