自动缩放Axon的跟踪事件处理器 [英] Automatically scale Axon's tracking event processors

查看:88
本文介绍了自动缩放Axon的跟踪事件处理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Axon Framework 4.0.3和Spring Boot中使用事件源,并具有一个跟踪处理器,该处理器配置为具有多个段/线程以同时处理事件:

I am using Axon framework 4.0.3 with Spring Boot to have event sourcing, and have one tracking processor which is configured to have multiple segments/threads to process events concurrently:

axon.eventhandling.processors[my_processor].initial-segment-count = 6
axon.eventhandling.processors[my_processor].thread-count = 3

这意味着有2个 my_processor 节点,每个节点使用3个线程.

It is meant to have 2 nodes of my_processor using 3 threads each.

但是,此解决方案的问题在于它不可扩展.我必须从一开始就知道必须拥有多少个节点和线程,因为以后无法更改:如果增加 initial-segment-count 并重新启动处理器,则什么也没有发生.更糟糕的是,如果我减少了段数:从未处理过用于已删除"段的事件!

However, the problem with this solution is that it's not scalable. I have to know from the very beginning how many nodes and threads I must have, as it's not possible to change it later: if I increase the initial-segment-count and restart the processor, nothing happens. Even worse if I decrease the segment count: events that were meant for the "removed" segments are never processed!

理想情况下,它应该只能指定每个节点应使用的线程数.之后,将新节点添加到处理器时,段数应相应扩大.同样,如果删除节点,则段数应按比例缩小.使用Axon可以做到这一点,还是根本不打算以这种方式进行缩放?

Ideally it should be able to specify just the number of threads that each node should use. After that, when new nodes are added to the processor, the number of segments should scale up accordingly. Similarly if I remove nodes, the number of segments should scale down. Is this possible with Axon, or is it not designed to be scaled this way at all?

推荐答案

您的假设完全正确-在运行时 ,仅调整这些字段是不可扩展的.这正是我们引入分割和合并操作以在Axon应用程序运行时分割/合并段的原因.请参阅 GitHub拉取请求,以将其引入框架.

This assumption from your part is completely right - just adjusting these fields is not scalable, at runtime. This is exactly why we have introduced the Split and Merge operations, to split/merge segments at runtime of your Axon application. See this GitHub pull request for it's introduction into the framework.

此功能将成为Axon 4.1(今天发布)的一部分.请注意,如果仅使用框架,此功能不会不会为您提供自动缩放.它将需要您自己实施,以利用提供的split and merge API使其自动化.

This feature will be part of Axon 4.1, which will be released today. Do note that if you're only using the framework, this feature does not give you the automatic scaling. It will require implementation from your part, leveraging the provided split and merge API, to make it automatic.

Axon服务器为您提供了一个拆分/合并按钮,用户界面,从而使您不必自己构建它.我敢肯定,Axon Server最终也会引入自动缩放解决方案,但不是4.1版的一部分.

Axon Server on the other hand provides you with a split/merge button in the UI, thus relieving you of the necessity to build this yourself. I am fairly certain Axon Server will also introduce an auto scaling solution eventually, but not as part of release 4.1.

希望这会给您一些背景Archie!

Hope this gives you some background Archie!

这篇关于自动缩放Axon的跟踪事件处理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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