vert.x 事件总线可以取代对 Kafka 的需求吗? [英] can vert.x event bus replace the need for Kafka?

查看:45
本文介绍了vert.x 事件总线可以取代对 Kafka 的需求吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在评估 vert.x 框架,看看我是否可以减少使用 Spring Boot 开发的微服务之间基于 Kafka 的通信.

I am evaluating the vert.x framework to see if I can reduce the Kafka based communications between my microservices developed using spring boot.

问题是:我可以更换吗1. 带有 vert.x 事件总线的 Kafka 和2. 带有基于 vert.x 的 verticles 的 spring boot 微服务

The question is: Can I replace 1. Kafka with vert.x event bus and 2. spring boot microservices with vert.x based verticles

任何指针都会有很大帮助.

Any pointers will be of great help.

提前致谢.

推荐答案

为了快速回答,我会说这取决于您的需求.

To answer quickly, I would say it depends on your needs.

是的,事件总线可以是使用异步和非阻塞范式处理微服务顶点之间本地通信的好方法.

Yes, the eventbus can be a good way to handle natively communication between microservices verticles using an asynchronous and non-blocking paradigm.

但在某些情况下,您可能需要:

But in some cases you could need:

  • 处理一些常见的企业模式,如重放机制、消息持久化、事务读取
  • 能够按时间顺序处理某种消息
  • 处理多种微服务之间的通信,这些微服务并非都是用相同的框架/工具包甚至编程语言编写的
  • 处理可靠性、弹性和当您的所有消费者/微服务/Verticle 都死亡时进行故障恢复
  • 处理消费者/微服务/垂直的动态水平可扩展性和监控
  • 能够使用部署在多数据中心和多区域的单个集群

在这些情况下,我更愿意选择 Apache Kafka,而不是本机事件总线或旧的 JMS 兼容系统.

In those cases I'd prefer to choose Apache Kafka over the native eventbus or an old fascioned JMS compliant system.

不禁止在同一个微服务架构中根据自己的实际需要同时使用eventbus和kafka.例如,您可以让一个 kafka 消费者组读取 kafka 主题来处理扩展、监控、故障恢复和回复机制,然后通过 eventbus 处理子垂直之间的通信.

It's not forbidden to use both eventbus and kafka in the same microservices architecture according to your real needs. For example, you could have one kafka consumers group reading a kafka topic to handle scaling, monitoring, failure recovery and reply mechanism and then handle communication between your sub-verticles through the eventbus.

我将澄清可扩展性和监控部分,并解释为什么我认为通过原生 eventbus 和 vert.x 集群模式使用 Kafka 处理更简单:Kafka 允许我们实时了解(通过 JMX 指标describe 命令):

I'll clarify a little bit for the scalability and monitoring part and explain why I think it's more simple to handle that with Kafka over the native eventbus and cluster mode with vert.x : Kafka allow us to know in real time (through JMX metrics and the describe command):

  • 滞后"对应的话题未读消息数
  • 每个组中正在收听主题的消费者数量
  • 每个消费者影响的主题的分区数
  • I/O 指标

因此可以使用 ElasticStack 或 Prometheus+Grafana 解决方案来监控这些指标并使用它们来处理动态可扩展性(当您知道需要临时增加消费者数量时,例如根据滞后指标和分区数和主机的 cpu/ram/swap 指标).

So it's possible to use an ElasticStack or Prometheus+Grafana solution to monitor those metrics and use them to handle a dynamic scalability (when you know that there's a need to increase temporarily the number of consumers for example according to the lag metric and the number of partitions and the cpu/ram/swap metrics of your hosts).

要回答 vert.x 或 SpringBoot 的第二个问题,我的回答不是很客观,但我会投票支持 vert.x 的 在 JVM 上的性能,尤其是它的简单性.我有点厌倦了 Spring 工厂及其庞大的抽象层,这些抽象层将大量问题隐藏在引发大量 AOP 的大量注释之下.

To answer the second question vert.x or SpringBoot my answer will be not very objective but I'd vote for vert.x for its performances on the JVM and especially for its simplicity. I'm a little tired of the Spring factory and its big layers of abstraction that hides a lot of issues under a mountain of annotations triggering a mountain of AOP.

此外,在微服务的 Java 世界中,还有其他 SpringBoot 替代方案,例如 Microprofile 的不同实现(例如thorntail项目).

Moreover, In the Java world of microservices, there's other alternatives to SpringBoot like the different implementations of Microprofile (thorntail project for example).

这篇关于vert.x 事件总线可以取代对 Kafka 的需求吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆