【发布时间】:2019-02-13 10:22:43
【问题描述】:
我在使用火花流时遇到严重的性能问题。对于 10 秒的批处理间隔,程序大约需要 2 分钟。我尝试在没有来自 kafka 主题的 0 条消息的情况下进行调试。即使没有要使用/处理的消息,大多数转换也需要超过 30 秒的时间。即使 decodeMessagesDF 中没有消息,以下命令也需要大约 40 秒。
val enrichedDF: DataFrame = decodeMessagesDF.join(broadcast(customer), (decodeMessagesDF( "rowkey") === customer("rowkey")) && (customer("mkt_opto_flag") === "N") && (customer("ads_opto_flag") === "N"))
此外,以下发布代码也需要大约 30 秒才能发布 0 条消息
message.foreachPartition{ part =>
val producer = new KafkaProducer[String, String](props)
part.foreach{ msg =>
val message = new ProducerRecord[String, String](topic, msg._1, msg._2)
producer.send(message)
}
producer.close()
}
如果代码中有任何错误,请告诉我。谢谢
【问题讨论】:
-
您在日志中找到任何线索吗? AFAIK,代码看起来不错。
-
不,我在日志中找不到任何内容。谢谢
标签: apache-spark apache-kafka apache-spark-sql spark-streaming