简体   繁体   English

在 Azure 服务总线中寻找事件中心与主题的清晰度

[英]Looking for clarity on Event Hubs vs Topics in Azure Service Bus

I've been learning about Event Hubs and just want to get confirmation or correction on my perspective on Event Hubs?我一直在了解事件中心,只是想确认或纠正我对事件中心的看法? I'm used to leveraging retries, poison messages, at least once delivery and so on for normal enterprise messaging solutions, which Azure Service Bus Queues and Topics give me.我习惯于利用 Azure 服务总线队列和主题为我提供的正常企业消息传递解决方案中的重试、有害消息、至少一次传递等。 It seems that Event Hubs is intended to provide a different tool for very high scale where you have to give up a little of the more “enterprise” features for much higher scale.似乎事件中心旨在为非常高的规模提供一种不同的工具,在这种情况下,您必须放弃一些更“企业”的功能以获得更高的规模。

Am I thinking about this correctly?我是否正确地考虑了这一点? Are there additional specifics I need to consider as well?我还需要考虑其他细节吗? I realize there could be some functional overlap with Event Hubs and Topics, but I'm just looking to get some clarity on how to think of using Event Hubs.我意识到事件中心和主题可能存在一些功能重叠,但我只是想弄清楚如何考虑使用事件中心。

If you have the choice it's almost always easier to write a system based around a full enterprise pubsub messaging system where you can mark single events as having been consumed, retry messages, and just about every other wonderful feature.如果您有选择,那么基于完整的企业 pubsub 消息传递系统编写一个系统几乎总是更容易,您可以在其中将单个事件标记为已被使用、重试消息以及几乎所有其他精彩功能。 If you've already accepted partitioning your message channel (which Azure Service Bus Topics appear to support) then you could in principle scale a more full featured messaging system to the degree you require.如果您已经接受对消息通道进行分区(Azure 服务总线主题似乎支持),那么原则上您可以将功能更全面的消息系统扩展到您需要的程度。 The issue is at what cost?问题是什么代价?

An Azure Service Bus Topic has a cost at high scale of approximately $0.20 per Million messages, Amazon SQS (somewhat similar) lists $0.50 per Million . Azure 服务总线主题的大规模成本约为 每百万条消息0.20 美元,Amazon SQS(有些类似)列出 每百万条消息0.50 美元 If you host it yourself you'll likely need to set up a lot of RabbitMQ servers or even multiple clusters as you partition.如果您自己托管它,您可能需要在分区时设置许多 RabbitMQ 服务器甚至多个集群。

Azure Event Hub costs $0.028 per Million plus an amount per throughput unit, same for Amazon Kinesis. Azure 事件中心的成本为每百万 0.028 美元加上每个吞吐量单位的金额,Amazon Kinesis相同 Apache Kafka has been benchmarked at 2 Million per second on 3 machines Apache Kafka 在 3 台机器上的基准测试为每秒 200 万

At say 20,000 events per second sustained the difference between some Azure Topics and Azure Event Hub is in the range of a full time developer's salary.以每秒 20,000 个事件为例,某些 Azure 主题和 Azure 事件中心之间的差异在全职开发人员的薪水范围内。 At 2 million per second sustained (which requires contacting MS), the difference is approaching $1M/month.每秒持续 200 万(需要联系 MS),差异接近 100 万美元/月。

Basically use the partitioned stream|log / offset tracking systems when you either don't need all the useful features of a full messaging system, or when you don't need them enough to pay the ~10X premium.当您不需要完整消息传递系统的所有有用功能时,或者当您不需要它们来支付大约 10 倍的溢价时,基本上使用分区流|日志/偏移量跟踪系统。 (Or can't use them because you can't scale the proper messaging system enough without heroic efforts). (或者不能使用它们,因为如果没有英勇的努力,您就无法充分扩展适当的消息传递系统)。

i wrote a post a while ago about this topic with some support from Dan on the Service Bus Team.不久前,我在服务总线团队的 Dan 的支持下写了一篇关于这个主题的帖子。 Hopefully this should clarify for you希望这应该为您澄清

http://microsoftintegration.guru/2015/03/03/azure-event-hubs-vs-azure-messaging/ http://microsoftintegration.guru/2015/03/03/azure-event-hubs-vs-azure-messaging/

Service Bus ( Messaging )服务总线(消息

For messaging it's about one application telling one or more apps to DO SOMETHING or GIVE ME SOMETHING.对于消息传递,它是关于一个应用程序告诉一个或多个应用程序做某事或给我某事。

Event Hub ( Eventing )事件中心(事件

The alternative is that in eventing the applications are saying SOMETHING HAS HAPPENED.另一种方法是在事件中应用程序说发生了一些事情。

Correct!!正确的!!

The fundamental difference between EventHubs and Topics is - TOPICS offer per-message semantics - whereas, EventHubs - offer Stream Semantics - implies, one should not expect any per-message feature/semantics with EventHubs. EventHubs 和 Topics 之间的根本区别是 - TOPICS 提供每消息语义- 而 EventHubs - 提供流语义- 意味着,不应期望 EventHubs 有任何per-message功能/语义。

Any middle-tier providing per-message features comes with the processing overhead (the tax) !!任何提供per-message功能的中间层都会带来processing overhead (the tax) !!

For Ex: Per message Duplicate detection, Receive confirmation per message (topics have a Message.Complete to ack Msg received) - are all Topic features.例如:每条消息重复检测,每条消息接收确认(主题有一个 Message.Complete 来确认收到的消息) - 都是主题功能。 EventHubs narrows-down the feature set to provide a better low-latency/high-throughput solution. EventHub 缩小了功能集的范围,以提供更好的低延迟/高吞吐量解决方案。

To visualize features like at-least-once delivery (of per msg is not available in EventHubs) is to translate it to stream semantics - Read until a point in a Given eventHub partition and checkpoint and let your application which is consuming those events handle the at-least-once delivery.将至少一次交付(每个 msg 在 EventHub 中不可用)等功能可视化是将其转换为流语义 - 读取直到给定 eventHub 分区和检查点中的某个点,并让使用这些事件的应用程序处理at-least-once交付。

more on Event Hubs... 更多关于事件中心...

According to this MS Learn article and "Choose between Azure messaging services" on what to choose:根据这篇MS Learn 文章“在 Azure 消息服务之间进行选择关于选择什么:

"Azure Event Hubs is designed for high-flow analytics types of events. Azure Service Bus and storage queues are for messages, which can be used for binding the core pieces of any application workflow." “Azure 事件中心专为高流量分析类型的事件而设计。Azure 服务总线和存储队列用于消息,可用于绑定任何应用程序工作流的核心部分。”

It's important to understand the difference between what events and messages are for because communication services are typically designed to handle their respective objects-- Event Hubs handles events and Service Bus handles messages.了解事件和消息的用途之间的区别很重要,因为通信服务通常设计为处理它们各自的对象——事件中心处理事件,服务总线处理消息。

An event triggers a notification that something has occurred.事件触发通知,表明某事已发生。 It's "lighter" than a message--it has info about what happened, but doesn't have the data that triggered the event itself.它比消息“更轻”——它有关于发生了什么的信息,但没有触发事件本身的数据。 For example, an event may notify you of a file upload and has info about the file, but not the file itself.例如,事件可能会通知您文件上传并包含有关文件的信息,但包含文件本身。 Events are usually used for broadcast communication/fan-out workflow, ie when you have a large number of subscribers for each publisher.事件通常用于广播通信/扇出工作流,即当每个发布者都有大量订阅者时。 The publisher has no expectation on how an event is handled by the consumer.发布者对消费者如何处理事件没有期望。

A message contains the data that triggers the message pipeline.消息包含触发消息管道的数据。 Unlike an event, the publisher has expectations on how the message is handled by the consumer.与事件不同,发布者对消费者如何处理消息有期望。 For example, a publisher sends a message with raw data produced by a service and expects the consumer to store that data and send back a response when done.例如,发布者发送一条包含由服务产生的原始数据的消息,并期望消费者存储该数据并在完成后发回响应。

(There's also Event Grid, which handles events too, but is different from Event Hubs. Whereas Event Hubs is designed for big data pipeline that involves analytics, Event Grid is designed for event-driven reactive programming.) (还有事件网格,它也处理事件,但与事件中心不同。事件中心是为涉及分析的大数据管道而设计的,而事件网格是为事件驱动的反应式编程而设计的。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM