什么时候hive在运行大数据量的统计查询语句时。常常会出现以下OOM错误。详细错误提演示样例如以下:

Possible error: Out of memory due to hash maps used in map-side aggregation.

Solution: Currently hive.map.aggr.hash.percentmemory is set to 0.5. Try setting it to a lower value. i.e 'set hive.map.aggr.hash.percentmemory = 0.25;'

查看task的失败信息为:

Error:GC overhead limit exceeded

对于这个错误,一般是由两种情况造成的:(1) hive sql写的不合理,导致运行时hash map过大;(2)hive sql没有优化的余地了(要得到想要的数据仅仅能写这种sql)。

对于(1)则改变sql语句,从而减少hash map的大小。对于(2)则能够调整參数。

以下分别说明(1)和(2)的情况:

(1)改变sql语句

select count(distinct v) from tbl;
能够改为select count(1) from (select v from tbl group by v) t;

说明:降低了hash map的key个数

select collect_set(messageDate)[0],count(*) from incidents_hive group by substr(messageDate,8,2);
能够改为select hourNum, count(1) from (select substr(messageDate,9,2) as hourNum from incidents_hive ) t group by hourNum;

说明:没有降低hash
map的key个数。可是降低了value的大小

(2)调整參数

对于这个sql语句。是没办法进行优化(由于keywords的反复率非常低。导致map阶段里面维护的一个内存Map对象非常巨大)来减少hash
map大小的:

INSERT OVERWRITE TABLE hbase_table_poi_keywords_count SELECT concat(substr(key,0,8), svccode, keywords), substr(key,0,8), svccode, keywords, count(*) where substr(key,0,8)=\"$yesterday\" AND length(keywords)>0 AND svccode is not null GROUP BY substr(key,0,8),svccode,keywords;

与mapjoin和map aggregate相关的优化參数有:

hive.map.aggr

hive.groupby.mapaggr.checkinterval

hive.map.aggr.hash.min.reduction

hive.map.aggr.hash.percentmemory

hive.groupby.skewindata

以上參数能够查看配置文件说明即文档进行调整。

假设需求确实没法通过调整这些參数来达到,那么set hive.map.aggr=false便是终于的方案,它肯定能满足你需求。仅仅是运行速度比map join 和 map aggr慢些,但通过实际跑数据你非常可能发现事实上它也不慢哈。

參考文章:

http://blog.csdn.net/macyang/article/details/9260777

http://www.myexception.cn/open-source/1487747.html

http://blog.csdn.net/lixucpf/article/details/20458617

INSERT OVERWRITE TABLE hbase_table_poi_keywords_count SELECT concat(substr(key,0,8), svccode, keywords), substr(key,0,8), svccode, keywords, count(*) where substr(key,0,8)=\"$yesterday\" AND length(keywords)>0 AND svccode is not null GROUP BY substr(key,0,8),svccode,keywords;

版权声明:本文博主原创文章,博客,未经同意不得转载。

Hive ERROR: Out of memory due to hash maps used in map-side aggregation的更多相关文章

  1. Out of memory due to hash maps used in map-side aggregation解决办法

    在运行一个group by的sql时,抛出以下错误信息: Task with the most failures(4): -----Task ID:  task_201411191723_723592 ...

  2. 黄聪:wordpress中PHP运行错最有效解决办法Fatal error: Out of memory (allocated 6029312)(转)

    近日在升级wordpress 3.2.1和若干插件的过程中,发现了一个wordpress的错误:Allowed memory size of XXX bytes exhausted Fatal err ...

  3. PHP运行错最有效解决办法Fatal error: Out of memory (allocated 786432) (tried to allocate 98304 bytes) in H:\freehost\zhengbao2\web\includes\lib_common.php on line 744

    原文 PHP运行错最有效解决办法Fatal error: Out of memory (allocated 6029312) Fatal error: Out of memory (allocated ...

  4. Tomcat7 JDK8 Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000540000000, 5368709120, 0) failed; error='Cannot allocate memory' (errno=12)

    [root@crm-web- bin]# shutdown.sh bash: shutdown.sh: command not found [root@crm-web- bin]# sh shutdo ...

  5. android stdio 编译项目报Error:Failed to find target with hash string 'android-24

    android stdio 编译项目报Error:Failed to find target with hash string 'android-24 查看已有的SDK 设置项目的sdk为 25 an ...

  6. wp8.1 sqlite Error - Deployment optimization failed due to an assembly that's not valid.

    这里我们使用的sqlite的版本为3.8.5,vs2013在发布的时候出现 Error - Deployment optimization failed due to an assembly that ...

  7. Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000fa980000, 59244544, 0) failed; error='Cannot allocate memory' (errno=12)

    启动项目报错 Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000fa980000, 592445 ...

  8. Fatal Error: Out of memory php内存溢出处理三种方法

    有时候我们在运行php程序的时候会发现 Fatal Error: Out of memory 这样的提示,这有可能是程序中用到了大量了变量和对象,导致分配的内存不够用. 修改php.ini文件里的me ...

  9. OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Out of memory' (errno=12)

    使用docker 安装kafka时启动失败 查看报错日志 # docker logs --since 30m 71846a96e514 Excluding KAFKA_HOME from broker ...

随机推荐

  1. Apache+windows server2008 外网访问配置

    之前在一个服务器上部署一个apache网站,在局域网内都可以访问,但是外网始终访问不了,经常多次谷歌,把解决方案总结出来. 下面就默认部署apache自带的网站.系统:windows server20 ...

  2. C#实现树的双亲表示法

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbHVja3k1MTIyMg==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...

  3. FreeSwitch安装和配置记录

    安装FreeSwitch 主要示例,下面的命令: git clone -b v1.2.stable git://git.freeswitch.org/freeswitch.git cd freeswi ...

  4. 浅谈spring——注解配置(九)

    spring定义一个切面是件麻烦的事情,需要实现专门的接口,还要进行一些较为复杂的配置,有没有较为简单的方法??? @AspectJ注解可以很容易定义一个切面,且不需要实现任何的接口.缺点是对JDK的 ...

  5. linux使用进阶(一)

    本文依据<应该知道的Linux技巧>coolshell上的一篇文章提到的Linux技巧,结合自己掌握的情况进行扩展和总结得来.主要包含下面内容:     一.日常操作     二.数据处理 ...

  6. nagios二次开发(五岁以下儿童)---nagios和nagiosql关系

    基于nagios和nagiosql理解.这将是这两个梳理比较粗糙的简单关系,有关详细信息,请参阅下面的图如:      从上面的关系图中能够看出,nagios与nagiosql共享了主机.主机组.服务 ...

  7. 微信公众平台PHP开发

    p=932" style="color: rgb(255, 153, 0); text-decoration: none;">微信公众平台PHP开发 2013.05 ...

  8. 初始化openwrt的rootpassword

    更改openwrt源代码 shadow 文件 package/base-files/files/etc/shadow shadow 文件參考http://blog.csdn.net/u01164188 ...

  9. The Official Preppy Handbook

    The Official Preppy Handbook: Lisa Birnbach: 9780894801402: Amazon.com: Books The Official Preppy Ha ...

  10. ZOJ 1584:Sunny Cup 2003 - Preliminary Round(最小生成树&amp;&amp;prim)

    Sunny Cup 2003 - Preliminary Round April 20th, 12:00 - 17:00 Problem E: QS Network In the planet w-5 ...