实践中使用Kafka和Flink进行实时事件连接
Real-time Event Joining in Practice With Kafka and Flink
AI总结:
本文介绍将机器学习流水线从批量训练迁移到基于Kafka和Flink的实时流式系统,通过流式连接、分区、Avro压缩等手段降低85%吞吐量和40%成本,并解决因果依赖与投递保证等问题。
摘要:
历史上,机器学习训练流水线主要依赖批量训练模型,每隔几小时重新训练一次模型。然而,工业实践者已经证明,实时训练可以带来更具适应性和个性化的用户体验。从批量到实时的转变充满了权衡,既要获得准确性和新鲜度的好处,又要保持低成本,并拥有一个可预测、可维护的系统。我们的工作描述了使用Apache Kafka和Flink为机器学习模型迁移到流式流水线的过程。我们演示了如何从Google Pub/Sub过渡到Kafka以处理传入的实时事件,并利用Flink通过RocksDB和检查点进行流式连接。我们还解决了诸如管理事件之间的因果依赖关系、平衡事件时间与处理时间,以及确保精确一次与至少一次投递保证等挑战,以及其他问题。此外,我们展示了如何通过使用Kafka中的主题分区来提高可扩展性,通过使用Avro模式和压缩将事件吞吐量降低了85%,将成本降低了40%,并实现了一条单独的流水线来确保数据正确性。我们的研究结果为实时系统的权衡和复杂性提供了有价值的见解,使得能够针对特定需求做出更明智的决策,从而构建有效的流式系统,提升用户满意度。
英文摘要:
Historically, machine learning training pipelines have predominantly relied on batch training models, retraining models every few hours. However, industrial practitioners have proved that real-time training can lead to a more adaptive and personalized user experience. The transition from batch to real-time is full of tradeoffs to get the benefits of accuracy and freshness while keeping the costs low and having a predictable, maintainable system. Our work characterizes migrating to a streaming pipeline for a machine learning model using Apache Kafka and Flink. We demonstrate how to transition from Google Pub/Sub to Kafka to handle incoming real-time events and leverage Flink for streaming joins using RocksDB and checkpointing. We also address challenges such as managing causal dependencies between events, balancing event time versus processing time, and ensuring exactly-once versus at-least-once delivery guarantees, among other issues. Furthermore, we showcase how we improved scalability by using topic partitioning in Kafka, reduced event throughput by \textbf{85\%} through the use of Avro schema and compression, decreased costs by \textbf{40\%}, and implemented a separate pipeline to ensure data correctness. Our findings provide valuable insights into the tradeoffs and complexities of real-time systems, enabling better-informed decisions tailored to specific requirements for building effective streaming systems that enhance user satisfaction.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。