gpt4 book ai didi

apache-spark - Spark : Is receiver in spark streaming a bottleneck?

转载 作者:行者123 更新时间:2023-12-04 04:42:44 25 4
gpt4 key购买 nike

我想了解接收器如何在 Spark Streaming 中工作。根据我的理解,将有一个接收器任务在执行器中运行,用于收集数据并保存为 RDD。当调用 start() 时,接收器开始读取。需要澄清以下内容。

  • Spark Streaming 作业启动了多少个接收器?多个还是一个?
  • 接收器是基于推送还是基于拉?
  • 无论如何,接收器会成为瓶颈吗?
  • 为了达到并行度,数据应该跨工作节点进行分区。因此,对于流数据,数据如何跨节点分布。
  • 如果基于批处理时间间隔在新节点上形成新的RDD,那么在Job提交后SparkContext如何将转换函数序列化到节点?
  • 接收器发射的数量可以通过参数控制吗?

  • 想了解 Spark Streaming 和接收器的剖析。

    最佳答案

    我将根据我使用 Kafka 接收器的经验来回答,这似乎或多或少类似于 Kinesis 中发生的事情。

    How many receivers does the Spark Streaming job starts?. Multiple or One.



    您打开的每个接收器都是一个连接。在Kafka中,如果要从多个分区并发读取,则需要打开多个接收器,通常将它们联合在一起。

    Is the receiver is implemented as push based or pull based?



    拉。在 Spark Streaming 中,每个批处理间隔(在创建 StreamingContext 时指定)从 Kafka 中提取数据。

    In any case does the receiver can become a bottleneck?



    广泛的问题。这取决于。如果您的批次间隔很长并且您只有一个接收器,则您的积压工作可能会开始填满。它主要是跟踪和错误,直到您在流媒体工作中达到最佳平衡。

    To achieve the degree of parallelism the data should be partitioned across the worker nodes. So for the streaming data the how the data is distributed across the nodes.



    您可以通过向底层数据源打开多个接收器来创建我之前所说的并发。此外,读取数据后,可以使用标准的 Spark 数据分区机制对其进行重新分区。

    If new RDDs are formed on an new node based on batch time interval, how does SparkContext serialize the transform functions to the node after the Job is submitted.



    通过使用选择的序列化器并通过网络发送数据,它以相同的方式序列化阶段中的每个任务。不确定我明白你在这里的意思。

    Can the amount of receivers launch be controlled by a parameter?



    是的,您可以有一个配置参数来确定您打开的接收器的数量。这样的代码看起来像这样:
    // This may be your config parameter
    val numStreams = 5
    val kafkaStreams = (1 to numStreams).map { i => KafkaUtils.createStream(...) }

    val unifiedStream = streamingContext.union(kafkaStreams)
    unifiedStream.print()

    关于apache-spark - Spark : Is receiver in spark streaming a bottleneck?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35980596/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com