Uh oh!
There was an error while loading. Please reload this page.
[SPARK-22056][Streaming] Add subconcurrency for KafkaRDDPartition - #19274
[SPARK-22056][Streaming] Add subconcurrency for KafkaRDDPartition#19274fhan688 wants to merge 2 commits into
Conversation
bjkonglu
commented
Sep 20, 2017
I tried this method . It worked well. |
Will this break the assumption that one Kafka partition only map to one Spark partition? |
fhan688
commented
Sep 21, 2017
Yes. One Kafka partition will map to many Spark partitions, thus more executors can be used. |
jerryshao
commented
Sep 26, 2017
Hi @loneknightpy , think a bit on your PR, I think this can also be done in the user side. User could create several threads in one task (RDD#mapPartitions) to consume the records concurrently, so such feature may not be so necessary to land in Spark's code. What do you think? |
fhan688
commented
Sep 26, 2017
lonelytrooper... : P will more executors be used in RDD#mapPartitions way ? I'll try that later to see if it works. I think if Spark provides a convenient way for this , it would help users a lot and reduce their work , that still make sense. LOL |
jerryshao
commented
Sep 26, 2017
Yes, I understand your scenario, but my concern is that your proposal is quite scenario specific, it may well serve your scenario, but somehow it breaks the design purpose of KafkaRDD. From my understanding lots of user use |
fhan688
commented
Sep 27, 2017
Hi Jerry, thank you so much for discussing! Actually, we tried 'repartition' before introducing this feature and for two reasons we give it up. First, it leads to shuffle which may influence a lot in real time applications. Second, performance promotion is quite limited in 'repartition' way. You mentioned the assumption at the front that one Kafka partition map to one Spark partition, I wonder why this assumption is so vital ? |
This is because it is the only way to guarantee the ordering of data in Kafka partition mapping to Spark partition. Maybe some other users took as an assumption to write the code. Let's see others' feedbacks. Ping @zsxwing@koeninger would you please weigh in this PR? Thanks! |
fhan688
commented
Sep 27, 2017
I guessed that.. This is true, this feature can not ensure the ordering of data in one Kafka partition, but quite a few applications(like dealing with logs) do not need strict order guarantee in one Kafka partition. if they want, just do not use this feature, otherwise, this will achieves good performance promotion. So I think this feature maybe not so scenario specific. : P |
fhan688
commented
Sep 27, 2017
Thank you so much for inviting more discussions! |
koeninger
commented
Sep 27, 2017
Search Jira and the mailing list, this idea has been brought up multiple times. I don't think breaking fundamental assumptions of Kafka (one consumer thread per group per partition) is a good idea. |
AmplabJenkins
commented
Jun 9, 2018
Can one of the admins verify this patch? |
HyukjinKwon
commented
Jul 16, 2018
ping @lonelytrooper for @koeninger's comment. Otherwise, let me propose to close this for now. |
Closesapache#17422Closesapache#17619Closesapache#18034Closesapache#18229Closesapache#18268Closesapache#17973Closesapache#18125Closesapache#18918Closesapache#19274Closesapache#19456Closesapache#19510Closesapache#19420Closesapache#20090Closesapache#20177Closesapache#20304Closesapache#20319Closesapache#20543Closesapache#20437Closesapache#21261Closesapache#21726Closesapache#14653Closesapache#13143Closesapache#17894Closesapache#19758Closesapache#12951Closesapache#17092Closesapache#21240Closesapache#16910Closesapache#12904Closesapache#21731Closesapache#21095 Added: Closesapache#19233Closesapache#20100Closesapache#21453Closesapache#21455Closesapache#18477 Added: Closesapache#21812Closesapache#21787 Author: hyukjinkwon <gurwls223@apache.org> Closesapache#21781 from HyukjinKwon/closing-prs.
JIRA Issue:https://issues.apache.org/jira/browse/SPARK-22056
When spark streaming consuming data from Kafka in direct way , partition in Kafka and KafkaRDDPartition in spark streaming are now bijection. To enhance the computing ability of spark streaming, we always to increase the number of partitions in Kafka , but too many increments may lead problems in Kafka like leader selection.
So , we introduce a new mechanism that change bijection to one-to-many which controls by a new parameter named "topic.partition.subconcurrency". This mechanism will divide one KafkaRDDPartition to many according to the parameter in spark streaming side , thus will make spark streaming use computing resources more efficient and avoid the problems caused by increasing the Kafka partitions.
we test this in production , the processing capacity of spark streaming improves apparently.