Akka Stream Kafka 与 Kafka Streams [英] Akka Stream Kafka vs Kafka Streams
问题描述
我目前正在使用 Akka Stream Kafka与 kafka 交互,我想知道与 Kafka Streams 有什么区别.
I am currently working with Akka Stream Kafka to interact with kafka and I was wonderings what were the differences with Kafka Streams.
我知道基于 Akka 的方法实现了响应式规范并处理了 kafka 流似乎缺乏的背压功能.
I know that the Akka based approach implements the reactive specifications and handles back-pressure, functionality that kafka streams seems to be lacking.
与 akka 流 kafka 相比,使用 kafka 流有什么优势?
What would be the advantage of using kafka streams over akka streams kafka?
推荐答案
你的问题很笼统,我就从我的角度给出一个笼统的答案.
Your question is very general, so I'll give a general answer from my point of view.
首先,我有两个使用场景:
First, I've got two usage scenario:
- 在我从 kafka 读取数据、处理数据并将一些输出写回 kafka 的情况下,对于这些我只使用 kafka 流.
- 数据源或接收器不是 kafka 的情况,对于我使用 akka 流的情况.
这已经可以让我回答关于背压的部分了:对于上面的第一个场景,kafka 流中有一个背压机制.
This already allows me to answer the part about back-pressure: for the 1st scenario above, there is a back-pressure mechanism in kafka streams.
现在让我们只关注上述第一个场景.如果我决定停止使用 Kafka 流,让我们看看我会失去什么:
Let's now only focus on the first scenario described above. Let's see what I would loose if I decided to stop using Kafka streams:
- 我的一些流处理器阶段需要一个持久(分布式)状态存储,kafka 流为我提供了它.这是 akka 流不提供的东西.
- 缩放,kafka 流会在流处理器的新实例启动或被杀死后立即自动平衡负载.这适用于同一个 JVM 以及其他节点:向上和向外扩展.这不是由 akka 流提供的.
这些是对我来说最重要的区别,我希望它对你有意义!
Those are the biggest differences that matter to me, I'm hoping that it makes sense to you!
这篇关于Akka Stream Kafka 与 Kafka Streams的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!