何时使用vert.x群集

发布于 2025-01-31 17:37:27 字数 303 浏览 5 评论 0原文

我有一个带有多个模块的Java(Gradle)项目。所有模块都在同一家服务器上运行,但我希望它们独立,IE模块A应该启动并停止,无论模块B是否正在运行或停止,反之亦然。 每个模块是一个Vert.x Verticle,模块应能够相互通信。 我读到,如果垂直在同一台计算机上运行,​​那么创建一个群集的VERTX实例不是一个好习惯,但是如果我不聚集它们,那么我会得到不同的实例,因此也有不同的eventbusses。

您会推荐什么?

(1)将垂直在同一台计算机上

(2)让垂直通过路由器通信(这是不良练习吗?)

(3)以某种方式重组项目

I have a java (gradle) project with multiple modules. All of the modules run on the same server but I want them to be independent, i.e. module A should be started and stopped no matter if module B is running or stopped and vice versa.
Each module is a vert.x verticle and the modules should be able to communicate with each other.
I read that if the verticles run on the same machine, it's not a good practice to create a clustered vertx instance, but if I don't cluster them, then I got different instances and therefore different eventbusses.

What would you recommend?

(1) Cluster the verticles on the same machine

(2) let the verticles communicate via a router (is this a bad practice?)

(3) Restructure the project in some way

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心清如水 2025-02-07 17:37:28

您可以要获取部署ID,还使用相同的ID Uneploy 。这意味着他们已经是独立的。

最简单的方法是让它们通过事件总线在相同的过程中运行。

选项1& 2您列出的将引入不必要的延迟,并使您的应用程序的性能更糟。

You can deploy verticles to get a deployment id and also undeploy them using the same id. That means they are already independent.

The simplest way would be to have them running in the same process communicating via the event bus.

Options 1 & 2 that you listed would introduce unnecessary latency and make your application perform worse.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文