gpt4 book ai didi

java - 使用 Weblogic session 复制进行内存数据库排序

转载 作者:行者123 更新时间:2023-12-01 21:51:08 24 4
gpt4 key购买 nike

我必须构建一种内存数据库,我知道我可以使用内存数据管理解决方案,例如 EhCache 和 HazelCast,但我倾向于不将它们插入我的系统并使用 Weblogic session 来实现复制。

以下是我的问题:

  • 由于这实际上不是一个用户 session ,我可以在应用程序启动时创建一个 session ,然后使用Weblogic session 复制功能来实现 session 复制吗?
    • 或者我应该考虑 Weblogic 应用程序上下文复制吗?这可能吗?
  • 我是否必须拥有 Weblogic 集群才能使用 WL session 复制,或者没有 Weblogic 集群也可以完成?
  • 假设我有 4 个 WL 服务器(在不同的机器上运行)并且全部位于同一集群中,如果任何节点/服务器获取了数据并将其放入 session 中,那么它会在所有其他节点/服务器中自动复制吗?<
  • 假设我关闭 3 个节点/服务器,重新启动这些节点后,我的 Activity 节点会自动将数据推送到起始节点吗?

最佳答案

您不应该使用网络 session 作为内存数据库。大多数内存数据库都允许微调数据在节点之间的分布方式。他们还提供交易和恢复支持。 Web session 是节点之间 Java 对象的非常简单的复制,您甚至不应该在其中保存关键数据。在 Web Session 对象中复制数据的主要目的是,在服务器出现故障的情况下,让用户在另一台服务器上保持登录状态,并继续其工作,即一些有状态的 Web UI。

根据您使用的 WebLogic 版本(基于获得的许可证),您可能已经可以访问 Oracle 内存数据网格解决方案 Coherence。

更新下面正确回答了OP的问题。

Since this is actually not a user session, can I create a session on application startup and then use Weblogic session replication feature to achieve session replication?

  • Or should I consider Weblogic application context replication and is it possible?

(Web 应用程序的)应用程序范围内的对象不会被复制。不过,您也许可以使用 JNDI 来做到这一点,但我再次不推荐这两种方法(包括启动监听器以某种方式将事物推送到 session )。

Do I mandatorily need to have Weblogic cluster to make use of WL session replication or it can be done without it as well?

是的,如果您想要 session 复制,则需要 WebLogic 集群。除了使用集群之外,还有一些要求。请参阅文档章节 6 Failover and Replication in a Cluster, in WLS 12.2.1 Docs .

Suppose I have 4 WL servers (running on different boxes) and all in same cluster, if any node/server has got the data and put it into the session then will it replicate automatically in all other nodes/server?

并非针对所有服务器,仅针对少数服务器。有关使用 Replication Groups 的更多详细信息,请参阅文档和其他选项。

Suppose I shutdown 3 nodes/server, upon restart of those nodes, will my alive nodes automatically push data into starting nodes?

没那么简单,但总之,并没有如你所愿。 session 不会复制到 WebLogic 集群中的所有节点。复制发生在足够多的节点(主节点和辅助节点)上。更多信息WLS Docs for 12.2.1

再次强调,您不应将 HTTP session 复制功能用作内存数据库。它根本不是为此而设计的。不要“构建某种内存数据库”,而是使用一个。

但是,如果您真的非常想使用 HTTP Session 作为“内存数据库”,至少要确保使用 Coherence*Web 作为 WebLogic 中的复制机制。

关于java - 使用 Weblogic session 复制进行内存数据库排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35183811/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com