Spark Streaming 避坑的注意事项

两个RDD不能嵌套计算:

Caused by: org.apache.spark.SparkException: RDD transformations and actions can only be 
invoked by the driver, not inside of other transformations; for example, rdd1.map(x => 
rdd2.values.count() * x) is invalid because the values transformation and count action 
cannot be performed inside of the rdd1.map transformation. For more information, see 
SPARK-5063.

解决方案:将一个rdd进行action转换后,保存在内存中。

计算中内存溢出

原因:
Spark Streaming执行一个流处理的时候,这个流处理还没有处理完成,又接入了下一流;

Exception in thread "JobGenerator" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:3236)

解决方案:加快每个流的处理速率,调整流处理的时间间隔,保证在下个流到来之前,当前流就处理完成。

资源配置不足或者过多


根据服务器核心数配置: executor-cores
根据服务器内存配置: executor-memory

例如:
--executor-memory 20G \
--executor-cores 20 \
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值