是否可以复制 JVM,以便在主 JVM 出现故障时我可以简单地从主 JVM 切换到辅助 JVM

发布于 2024-12-22 18:52:54 字数 69 浏览 3 评论 0原文

是否可以复制完整的 JVM,并且在发生故障转移时只需将负载翻转到复制的 JVM?

如果是的话我们该怎么做呢?

Is it possible to replicated a complete JVM and in case of failover simply flip the load to the replicated JVM?

If yes then how can we do it?

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

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

发布评论

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

评论(3

我们的影子 2024-12-29 18:52:55

理论上是的,但主要问题是您的应用程序会慢得多(例如 100 到 1000 倍),这就是大多数人不愿进行完整复制的原因。

相反,您需要生成重要信息的数据流,例如所有输入或输出消息(或两者),并将其发送到第二台机器并根据现有数据重新构建状态。

顺便说一句:当您失去与服务器的 TCP 连接时,必须关闭并重新连接。这些故障转移不是透明的。 UDP 通过没有连接来避免这个问题,但可靠地使用要困难得多。解决这个问题的一种方法是在客户端和服务器之间使用一个简单的代理/负载平衡服务器。因为它简单不太可能失败,并且它隐藏了与服务器的重新连接。无论您遇到数据中心故障,它也会消失。

Yes in theory, but the main problem would be that your applications will be much, much slower (like 100 to 1000x) and this is what puts most people off doing a full replication.

Instead you need produce a data stream of the important pieces of information e.g. all the input or out messages (or both) and send this to the second machine and re-build the state from the existing data.

BTW: When you lose a TCP connection with the server, these have to be closed and re-connected. These are not failed over transparently. UDP avoids this issue by not having connections but is much harder to work with reliably. One way around this is to have a simple proxy/load balancing server which sits between the client and the server. Because it is simple is less likely to fail, and it hides the reconnection with the server. However you have a data centre failure, it will be gone as well.

予囚 2024-12-29 18:52:54

如果您的应用程序是 Web 应用程序,请阅读“集群”和“负载平衡”。大多数应用服务器都支持集群。

您还可以查看 JGroups,它提供 JVM 间通信。

In case your application is a web app, read about "Clustering" and "Load Balancing". Most application servers support clustering.

You can also have a look at JGroups, which provides inter-JVM communication.

你穿错了嫁妆 2024-12-29 18:52:54

这不是在 JVM 级别完成的事情,但有许多产品可以在消息处理中处理此问题。通常这是企业服务总线的一项功能。谷歌一下,你会得到一些想法。

This is not something that's done at the JVM level, but there are many products out there that handle this in processing of messages. Usually this is a feature of an Enterprise Service Bus. Google that and you will get some ideas.

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