SQL/Apache Hive
Hive : hive.exec.reducers (Reducer에 메모리 할당하기)
CosmosProject
2021. 6. 4. 02:09
728x90
반응형
Hive에서 큰 데이터를 다루다보면 reducer가 더 많은 메모리를 필요로 하는 경우가 있습니다.
Reducer memory
set hive.exec.reducers.bytes.per.reducer = 256000000;
hive에서 위 setting은 하나의 reducer당 할당되는 메모리의 크기를 의미합니다.
reducer 하나에 할당되는 메모리 기본값은 256MB(256,000,000B)입니다.
위 예시는 기본값인 256MB를 할당하도록 되어있지만 이걸 바꾸면 원하는 크기의 메모리를 할당할 수 있습니다.
Reducer max
set hive.exec.reducers.max = 128;
reducer max option은 hive job마다 사용할 수 있는 최대 reducer의 개수를 정해줍니다.
과도하게 많은 reducer 사용을 방지할 수 있죠.
Reducer task number
set mapred.reduce.tasks = 300;
reduce tasks option은 모든 job마다 할당될 reducer의 개수를 정해주게 됩니다.
참고
위같은 option은 그냥 쿼리돌리듯이 돌리면 설정됩니다.
Apache Hive document = https://cwiki.apache.org/confluence/display/Hive/Configuration+Properties#ConfigurationProperties-Tez
728x90
반응형