How to make spark streaming process multiple batches?
Spark使用并行性,但是在测试我的应用程序并查看sparkUI时,在流选项卡下,我经常注意到在"活动批次"下,其中一个的状态为"处理中",其余的状态为"已排队"。 "。我可以配置一个参数使Spark同时处理多个批次吗?
注意:我使用的spark.streaming.concurrentJobs大于1,但这似乎不适用于批处理(?)
我想您正在使用Yarn启动您的火花流。
由于您没有足够的资源来同时启动您的流/火花批次,所以Yarn将您的批次排队。
您可以尝试通过:
限制Yarn的资源使用
1 2 3 4
| -driver-memory - > memory for the driver
--executor-memory - > memory for worker
-num-executors - > number of distinct yarn containers
--executor-cores - > number of threads you get inside each executor |
例如:
1 2 3 4 5 6 7 8
| spark-submit \\
--master yarn \\
--deploy-mode cluster \\
--driver-memory 800m \\
--executor-memory 800m \\
--num-executors 4 \\
-- class my. class \\
myjar |
- 您是正确的,我正在使用YARN。我正在运行的环境有很多资源,但是我确实尝试降低了执行程序的内存使用量,但这没有影响。我仍然得到越来越多的"排队"批处理列表。
-
尝试将--executor-memory增加到5GB并包含--executor-cores 4或任何数字以增加执行程序内的并行性。不要忘记给出spark.yarn.executor.memoryOverhead。