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]Avoid OOM and make shuffle write more stable #4013

Open
lgbo-ustc opened this issue Dec 12, 2023 · 1 comment
Open

[CH]Avoid OOM and make shuffle write more stable #4013

lgbo-ustc opened this issue Dec 12, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@lgbo-ustc
Copy link
Contributor

lgbo-ustc commented Dec 12, 2023

Description

Shuffle write and high cardinality aggregating is two high memory consumers. There is contention between the two in memory usage. The memory usage threshold is controled by two configures.

  • aggregating uses spark.gluten.sql.columnar.backend.ch.runtime_settings.max_memory_usage, or spark.memory.offHeap.size when max_memory_usage is not set.
  • shuffle write uses spark.gluten.sql.columnar.backend.ch.spillThreshold

When run a query to aggregate high cardinality keys, shuffle write offten causes OOM, because it doesn't know how much memory is currently available, but aggregating operators has token too much memory, leave the available memory less then spark.gluten.sql.columnar.backend.ch.spillThreshold.

@lgbo-ustc
Copy link
Contributor Author

We cannot rely on TaskMemoryManager to trigger spill shuffle splitter to perform spill action. It alway crush when this happens.

Following logs shows that CHCelebornHashBasedColumnarShuffleWriter is constantly being triggered to execute spill.

24/01/05 10:57:52.491 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.491 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.491 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.491 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.491 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.492 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.492 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.492 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.493 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.493 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.493 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.493 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.494 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.494 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.494 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.494 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.494 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data
24/01/05 10:57:52.494 INFO [Executor task launch worker for task 2.0 in stage 0.0 (TID 2)] CHCelebornHashBasedColumnarShuffleWriter: Gluten shuffle writer: Trying to push 4194328 bytes of data

then the executor crush

xxx xxxx evict:140166285792664
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (thread.cpp:1542), pid=76503, tid=140165920061184
#  guarantee(cur_sp > stack_yellow_zone_base()) failed: not enough space to reguard - increase StackShadowPages
#
# JRE version: Java(TM) SE Runtime Environment (8.0_60-b27) (build 1.8.0_60-b27)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode linux-amd64 compressed oops)
# Core dump written. Default location: /data6/hadoop/yarn/local/usercache/liangjiabiao/appcache/application_1703810192485_404000/container_e64_1703810192485_404000_01_000059/core or core.76503
#
# An error report file with more information is saved as:
# /data6/hadoop/yarn/local/usercache/liangjiabiao/appcache/application_1703810192485_404000/container_e64_1703810192485_404000_01_000059/hs_err_pid76503.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant