You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/hdinsight/hdinsight-hadoop-hive-out-of-memory-error-oom.md
+27-29Lines changed: 27 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,14 @@ title: Fix a Hive out of memory error in Azure HDInsight
3
3
description: Fix a Hive out of memory error in HDInsight. The customer scenario is a query across many large tables.
4
4
keywords: out of memory error, OOM, Hive settings
5
5
author: hrasheed-msft
6
+
ms.author: hrasheed
6
7
ms.reviewer: jasonh
7
-
8
8
ms.service: hdinsight
9
+
ms.topic: troubleshooting
9
10
ms.custom: hdinsightactive
10
-
ms.topic: conceptual
11
-
ms.date: 05/14/2018
12
-
ms.author: hrasheed
13
-
11
+
ms.date: 11/28/2019
14
12
---
13
+
15
14
# Fix an Apache Hive out of memory error in Azure HDInsight
16
15
17
16
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
20
19
21
20
A customer ran a Hive query:
22
21
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
+
```
38
39
39
40
Some nuances of this query:
40
41
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.
43
44
* All tables are joining each other, in some cases with multiple columns in TABLE1 and others.
44
45
45
46
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
75
76
76
77
The error remains when using a bigger virtual machine (for example, D12).
77
78
78
-
79
79
## Debug the out of memory error
80
80
81
81
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):
82
82
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."
84
84
85
85
The **hive.auto.convert.join.noconditionaltask** in the hive-site.xml file was set to **true**:
86
86
@@ -96,18 +96,16 @@ The **hive.auto.convert.join.noconditionaltask** in the hive-site.xml file was s
96
96
</property>
97
97
```
98
98
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.
100
100
101
101

102
102
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**.
104
104
105
105
> [!NOTE]
106
106
> The setting **hive.tez.java.opts** must always be smaller than **hive.tez.container.size**.
107
-
>
108
-
>
109
107
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:
0 commit comments