简体   繁体   中英

Hive : Tez how to increase AM Container memory

I am trying to run a hive query as

set yarn.nodemanager.vmem-check-enabled=false;
set hive.strict.checks.cartesian.product=false;
select count(*)
from db1.tb1 a
where a.col1='2015-07-13'
and a.col2='val'
and exists (
         select 1 from db2.tb2 b
         where b.col1='2015-07-13'
           and b.col2='val'
           and size(a.col3)=size(b.col3));

but i keep getting

Application application_1585768406438_10833 failed 2 times due to AM Container for appattempt_1585768406438_10833_000002 exited with  exitCode: -104
Failing this attempt.Diagnostics: [2020-04-26 19:47:06.497]Container [pid=30016,containerID=container_e03_1585768406438_10833_02_000001] is running beyond physical memory limits. Current usage: 1.0 GB of 1 GB physical memory used; 2.8 GB of 2.1 GB virtual memory used. Killing container.
Dump of the process-tree for container_e03_1585768406438_10833_02_000001 :s
--------|- PID PPID PGRPID SESSID CMD_NAME USER_MODE_TIME(MILLIS) SYSTEM_TIME(MILLIS) VMEM_USAGE(BYTES) RSSMEM_USAGE(PAGES) FULL_CMD_LINE
    |- 30101 30016 30016 30016 (java) 11364 769 3041062912 264859 /usr/lib/jvm/java-8-openjdk-amd64/bin/java -Xmx819m -Djava.io.tmpdir=/hadoop/yarn/nm-local-dir/usercache/a0t00wf/appcache/application_1585768406438_10833/container_e03_1585768406438_10833_02_000001/tmp -server -Djava.net.preferIPv4Stack=true -Dhadoop.metrics.log.level=WARN -XX:+PrintGCDetails -verbose:gc -XX:+PrintGCTimeStamps -XX:+UseNUMA -XX:+UseParallelGC -Dlog4j.configuratorClass=org.apache.tez.common.TezLog4jConfigurator -Dlog4j.configuration=tez-container-log4j.properties -Dyarn.app.container.log.dir=/var/log/hadoop-yarn/userlogs/application_1585768406438_10833/container_e03_1585768406438_10833_02_000001 -Dtez.root.logger=INFO,CLA -Dsun.nio.ch.bugLevel= org.apache.tez.dag.app.DAGAppMaster --session

I tried running this as mapreduce instead of tez but i face the same issue. I tried the following settings

Tez

set tez.am.resource.memory.mb=4096
set tez.task.resource.memory.mb=4096
set tez.am.java.opts=-Xmx6144m;
set tez.am.resource.memory.mb=4096;
set hive.tez.container.size=4096;

MR

set hive.execution.engine=mr;
set mapreduce.map.memory.mb=4096;
set mapreduce.reduce.memory.mb=4096;
set mapreduce.map.java.opts=-Xmx6144m;
set mapreduce.reduce.java.opts=-Xmx6144m;

and also these Yarn settings

set yarn.nodemanager.vmem-check-enabled=false;
set yarn.nodemanager.resource.memory-mb=98304;
set yarn.scheduler.minimum-allocation-mb=8192;
set yarn.scheduler.maximum-allocation-mb=98304;
set yarn.nodemanager.vmem-pmem-ratio=9;

but i always get the same error. How can i increase memory limits for AM container? I suspect that the issue is some limit on java memory as seen in the stacktrace

/usr/lib/jvm/java-8-openjdk-amd64/bin/java -Xmx819m

is that so? If so, how should i increase the java memory used by tez/hive?

First of all you need to understand heap is a subset of container. Your heap memory should be approximately 80% of container memory.

set hive.execution.engine=mr;  
set mapreduce.map.memory.mb=4096;  -- this is container memory
set mapreduce.reduce.memory.mb=4096;

Below values are wrong. They have to be less than 4096 or you will always get container running beyond memory limits issue.

set mapreduce.map.java.opts=-Xmx6144m;  -- this is heap memory
set mapreduce.reduce.java.opts=-Xmx6144m;

Instead set these to:

set mapreduce.map.java.opts=-Xmx3276m;   -- (80% of 4096)
set mapreduce.reduce.java.opts=-Xmx3276m;

Here is a good article on understanding these terms: https://community.cloudera.com/t5/Community-Articles/Demystify-Apache-Tez-Memory-Tuning-Step-by-Step/ta-p/245279

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM