Tomcat 上的会话复制有哪些缺点?

发布于 2024-09-05 06:03:02 字数 87 浏览 3 评论 0原文

我试图确定 Tomcat+Apache 反向代理模式中会话复制哪个更好。部署中更常见的是什么?会话复制还是会话保持?会话复制有什么缺点吗?

谢谢

I was trying to decide what is better in a Tomcat+Apache reverse proxy mode for session replication. What is more common on deployments? session replication or stick session? Are there any drawbacks for session replication?

Thanks

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

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

发布评论

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

评论(1

ゝ偶尔ゞ 2024-09-12 06:03:02

如果您进行会话复制,我可以指出以下注意事项。

性能

主要缺点是性能。复制会话涉及将会话数据复制到集群中的所有服务器。集群中的服务器越多,涉及的额外开销就越多。

Tomcat 通过定义两种会话复制模式来帮助解决此开销。

DeltaManager(默认)和 BackupManager

来自此 URL http://tomcat.apache。 org/tomcat-6.0-doc/cluster-howto.html

使用上述配置将
启用所有到所有会话复制
使用 DeltaManager 进行复制
会话增量。我们所说的“全对全”是指
会话被复制到
集群中的所有其他节点。
这对于较小的集群非常有用
但我们不建议将其用于较大的
集群(很多tomcat节点)。还
当使用增量管理器时,它会
复制到所有节点,甚至节点
没有该应用程序的
已部署。

为了解决这个问题,
您将需要使用备份管理器。
该管理器仅复制
会话数据到一个备份节点,以及
仅适用于具有
已部署应用程序。缺点是
BackupManager:不太像战斗
作为增量经理进行测试

阅读此 URL 了解良好的设计技巧集群(如果启用会话复制)。

内存

有多少并发用户将访问该应用程序?用户越多,会话中存储的数据就越多,因此会话复制就会过载。

代码注意事项

此外,您需要确保应用程序放入会话的数据是可序列化的。序列化会话数据会产生一些复制会话状态的开销。保持会话大小相当小是个好主意,因此开发人员需要检查放入会话中的数据量。

粘性会话

考虑到这些因素,它实际上取决于用例的关键性。如果您单独进行粘性会话,则在关键旅程中可能会丢失用户数据。

您是否有办法从中恢复 - 例如:通过在订单或付款过程的每个步骤将关键数据保存到数据库中?如果没有,用户必须登录并重新开始。这对于非交易性网站来说很好,但浏览小册子类型的数据或填写表格以捕获非付款等数据。

I can point out the following considerations if you go for session replication.

Performance

The main drawback will be on performance. Replicated sessions involve copying of session data over to all the servers in the cluster. The more servers you have in the cluster, the additional overheads involved.

Tomcat helps with this overhead by definining two modes for session replication.

DeltaManager (default) and BackupManager

From this URL http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

Using the above configuration will
enable all-to-all session replication
using the DeltaManager to replicate
session deltas. By all-to-all we mean
that the session gets replicated to
all the other nodes in the cluster.
This works great for smaller cluster
but we don't recommend it for larger
clusters(a lot of tomcat nodes). Also
when using the delta manager it will
replicate to all nodes, even nodes
that don't have the application
deployed.

To get around this problem,
you'll want to use the BackupManager.
This manager only replicates the
session data to one backup node, and
only to nodes that have the
application deployed. Downside of the
BackupManager: not quite as battle
tested as the delta manager

Read this URL for good design tips for the cluster if enabling session replication.

Memory

How many concurrent users will be hitting the application? the more users, the more data gets stored into sessions, and hence an overload for session replication.

Code considerations

Additionally you need to ensure the data being put into the session by the application is serializable. Serializing session data has some overhead for replicating the session state. It's a good idea to keep the session size reasonably small, so the developers need to check the amount of data being put into the session.

Sticky Sessions

Given these considerations, it actually depends on the criticality of the use cases. If you go for sticky sessions alone, then there is a chance of loss of user data during a critical journey.

Do you have means to recover from that - eg: by persisiting critical data into database at each step of a order or payment journey? If not the user has to login and start again. This is fine for websites which are not transactional, but browse brochureware type of data or filling out forms to capture data which is not payment etc.

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