How jobs are assigned to executors in Spark Stream

2020-02-01 01:33发布

Let's say I've got 2 or more executors in a Spark Streaming application.

I've set the batch time of 10 seconds, so a job is started every 10 seconds reading input from my HDFS.

If the every job lasts for more than 10 seconds, the new job that is started is assigned to a free executor right?

Even if the previous one didn't finish?

I know it seems like a obvious answer but I haven't found anything about job scheduling in the website or on the paper related to Spark Streaming.

If you know some links where all of those things are explained, I would really appreciate to see them.

Thank you.

1条回答
家丑人穷心不美
2楼-- · 2020-02-01 01:41

Actually, in the current implementation of Spark Streaming and under default configuration, only job is active (i.e. under execution) at any point of time. So if one batch's processing takes longer than 10 seconds, then then next batch's jobs will stay queued.

This can be changed with an experimental Spark property "spark.streaming.concurrentJobs" which is by default set to 1. Its not currently documented (maybe I should add it).

The reason it is set to 1 is that concurrent jobs can potentially lead to weird sharing of resources and which can make it hard to debug the whether there is sufficient resources in the system to process the ingested data fast enough. With only 1 job running at a time, it is easy to see that if batch processing time < batch interval, then the system will be stable. Granted that this may not be the most efficient use of resources under certain conditions. We definitely hope to improve this in the future.

There is a little bit of material regarding the internals of Spark Streaming in this meetup slides (sorry, about the shameless self advertising :) ). That may be useful to you.

查看更多
登录 后发表回答