Skip to content

Commit a717983

Browse files
authored
Merge pull request #97390 from dagiro/freshness79
freshness79
2 parents 9f5403e + 3a617b9 commit a717983

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

articles/hdinsight/hdinsight-hadoop-hive-out-of-memory-error-oom.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ title: Fix a Hive out of memory error in Azure HDInsight
33
description: Fix a Hive out of memory error in HDInsight. The customer scenario is a query across many large tables.
44
keywords: out of memory error, OOM, Hive settings
55
author: hrasheed-msft
6+
ms.author: hrasheed
67
ms.reviewer: jasonh
7-
88
ms.service: hdinsight
9+
ms.topic: troubleshooting
910
ms.custom: hdinsightactive
10-
ms.topic: conceptual
11-
ms.date: 05/14/2018
12-
ms.author: hrasheed
13-
11+
ms.date: 11/28/2019
1412
---
13+
1514
# Fix an Apache Hive out of memory error in Azure HDInsight
1615

1716
Learn how to fix an Apache Hive out of memory (OOM) error when processing large tables by configuring Hive memory settings.
@@ -20,26 +19,28 @@ Learn how to fix an Apache Hive out of memory (OOM) error when processing large
2019

2120
A customer ran a Hive query:
2221

23-
SELECT
24-
COUNT (T1.COLUMN1) as DisplayColumn1,
25-
26-
27-
….
28-
FROM
29-
TABLE1 T1,
30-
TABLE2 T2,
31-
TABLE3 T3,
32-
TABLE5 T4,
33-
TABLE6 T5,
34-
TABLE7 T6
35-
where (T1.KEY1 = T2.KEY1….
36-
37-
22+
```sql
23+
SELECT
24+
COUNT (T1.COLUMN1) as DisplayColumn1,
25+
26+
27+
….
28+
FROM
29+
TABLE1 T1,
30+
TABLE2 T2,
31+
TABLE3 T3,
32+
TABLE5 T4,
33+
TABLE6 T5,
34+
TABLE7 T6
35+
where (T1.KEY1 = T2.KEY1….
36+
37+
38+
```
3839

3940
Some nuances of this query:
4041

41-
* T1 is an alias to a big table, TABLE1, which has lots of STRING column types.
42-
* Other tables are not that big but do have many columns.
42+
* T1 is an alias to a large table, TABLE1, which has lots of STRING column types.
43+
* Other tables aren't that large but do have many columns.
4344
* All tables are joining each other, in some cases with multiple columns in TABLE1 and others.
4445

4546
The Hive query took 26 minutes to finish on a 24 node A3 HDInsight cluster. The customer noticed the following warning messages:
@@ -75,12 +76,11 @@ By using the Apache Tez execution engine. The same query ran for 15 minutes, and
7576

7677
The error remains when using a bigger virtual machine (for example, D12).
7778

78-
7979
## Debug the out of memory error
8080

8181
Our support and engineering teams together found one of the issues causing the out of memory error was a [known issue described in the Apache JIRA](https://issues.apache.org/jira/browse/HIVE-8306):
8282

83-
When hive.auto.convert.join.noconditionaltask = true we check noconditionaltask.size and if the sum of tables sizes in the map join is less than noconditionaltask.size the plan would generate a Map join, the issue with this is that the calculation doesn't take into account the overhead introduced by different HashTable implementation as results if the sum of input sizes is smaller than the noconditionaltask size by a small margin queries will hit OOM.
83+
"When hive.auto.convert.join.noconditionaltask = true we check noconditionaltask.size and if the sum of tables sizes in the map join is less than noconditionaltask.size the plan would generate a Map join, the issue with this is that the calculation doesn't take into account the overhead introduced by different HashTable implementation as results if the sum of input sizes is smaller than the noconditionaltask size by a small margin queries will hit OOM."
8484

8585
The **hive.auto.convert.join.noconditionaltask** in the hive-site.xml file was set to **true**:
8686

@@ -96,18 +96,16 @@ The **hive.auto.convert.join.noconditionaltask** in the hive-site.xml file was s
9696
</property>
9797
```
9898

99-
It is likely map join was the cause of the Java Heap Space our of memory error. As explained in the blog post [Hadoop Yarn memory settings in HDInsight](https://blogs.msdn.com/b/shanyu/archive/2014/07/31/hadoop-yarn-memory-settings-in-hdinsigh.aspx), when Tez execution engine is used the heap space used actually belongs to the Tez container. See the following image describing the Tez container memory.
99+
It's likely map join was the cause of the Java Heap Space out of memory error. As explained in the blog post [Hadoop Yarn memory settings in HDInsight](https://blogs.msdn.com/b/shanyu/archive/2014/07/31/hadoop-yarn-memory-settings-in-hdinsigh.aspx), when Tez execution engine is used the heap space used actually belongs to the Tez container. See the following image describing the Tez container memory.
100100

101101
![Tez container memory diagram: Hive out of memory error](./media/hdinsight-hadoop-hive-out-of-memory-error-oom/hive-out-of-memory-error-oom-tez-container-memory.png)
102102

103-
As the blog post suggests, the following two memory settings define the container memory for the heap: **hive.tez.container.size** and **hive.tez.java.opts**. From our experience, the out of memory exception does not mean the container size is too small. It means the Java heap size (hive.tez.java.opts) is too small. So whenever you see out of memory, you can try to increase **hive.tez.java.opts**. If needed you might have to increase **hive.tez.container.size**. The **java.opts** setting should be around 80% of **container.size**.
103+
As the blog post suggests, the following two memory settings define the container memory for the heap: **hive.tez.container.size** and **hive.tez.java.opts**. From our experience, the out of memory exception doesn't mean the container size is too small. It means the Java heap size (hive.tez.java.opts) is too small. So whenever you see out of memory, you can try to increase **hive.tez.java.opts**. If needed you might have to increase **hive.tez.container.size**. The **java.opts** setting should be around 80% of **container.size**.
104104

105105
> [!NOTE]
106106
> The setting **hive.tez.java.opts** must always be smaller than **hive.tez.container.size**.
107-
>
108-
>
109107
110-
Because a D12 machine has 28GB memory, we decided to use a container size of 10GB (10240MB) and assign 80% to java.opts:
108+
Because a D12 machine has 28 GB memory, we decided to use a container size of 10 GB (10240 MB) and assign 80% to java.opts:
111109

112110
SET hive.tez.container.size=10240
113111
SET hive.tez.java.opts=-Xmx8192m

0 commit comments

Comments
 (0)