WebSphere 中跨 JVM 的会话复制
我们建立了一个基础设施,其中网络服务器是集群的,而应用程序服务器不是。 Web 服务器根据循环策略将请求路由到应用程序服务器。
在这种情况下,一个应用程序服务器中可用的会话数据在另一应用程序服务器中不可用。 无论如何,是否可以在第二个应用程序中使用来自第一个应用程序服务器的会话数据? 这两个应用程序服务器在物理上是不同单元中独立的盒子。
一种方法可能是使用数据库 - 是否有其他方法来完成此会话复制?
We have an infrastructure set up where in the webservers are clustered and the application servers are not. The webservers route the request to the application servers based on round-robin policy.
In this scenario, the session data available in one application server is not available in the other application server. Is there anyway by which the session data from first application server can be made available in the second application ? The two application servers are physically separate boxes in different cells.
One approach could be to use the database - is there any other means of accomplishing this session replication ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在 WebSphere 中,本质上有两种方法来复制会话数据:
哪一种方法适合您的需求很大程度上取决于您的应用程序场景:
当您的所有数据都存储在数据库中时,会话数据的持久化有多重要?应用服务器宕机了?
您在某一时刻同时有多少个会话对象?
在数据库中,您可以存储许多会话而不会出现太多问题,另一个选项始终是有多少内存可用的问题。
如果您已经设置了数据库,那么我会选择数据库,无论如何所有应用程序服务器都使用该数据库。
以下是 WebSphere 信息中心 包含必要的详细信息。
In WebSphere there are essentially two ways to replicate session data:
Which one is appropriate for your needs is highly dependent on your application scenario:
How important is the persistence of your session data, when all your application servers go down?
How many session objects do you have at any one time simultaneously?
In a DB you can store many sessions without much problems, the other option is always a question of how much memory is available.
I would go with the database, if you already got one set up, which all application servers use anyway.
Here is the link to the WebSphere Information Center with the necessary details.
一种显而易见的解决方案是启用应用程序服务器的集群。 从你提出问题的方式来看,我认为你已经拒绝了这个选项。 另一种选择是更改 Web 服务器使用的路由以使用会话关联性(同一会话的请求发送到同一应用程序服务器)。
除此之外,我会附议德托尼的答案。
One obvious solution is to enable clustering of your application servers. I assume from the way you worded your question you have rejected this option. Another option is to change the routing used by the web servers to use session affinity (requests for the same session go to the same app server).
Other that that, I'd second the answer by dertoni.
也许你可以看看“兵马俑”。 它是一个缓存框架,可以缓存会话并在单独的服务器上运行
maybe you can look at 'terracota'. its an caching framework, which can cache sessions and runs on a seperate server
WebSphere 中的集群有两种选择:会话复制或数据库。 如果您有大型会话对象,则最好使用数据库,因为它允许您将过时的会话卸载到磁盘。 如果它们随后被表示,那么它们可以从数据库中提取,如果您使用会话复制,那么这些会话不仅需要保留在目标服务器上的内存中,还需要保留在复制组中的其他服务器上。 对于大型会话,这可能会导致内存不足的情况。
通过数据库会话处理,它也非常可定制,并且在我使用它的环境中性能不明显。
There are two options for clustering within WebSphere, session replication or database. If you have large session objects you are best off using database because it allows you to offload stale sessions to disk. If they are then represented then they can be extracted from the database, if you use session replication then those sessions need to stay in memory on not just your target server but also the other servers in the replication group. With large sessions this can lead to an out of memory condition.
With database session handling it is also very customisable and doesn't performance noticeably in the environments that I have used it.
不要忘记预言机的一致性。
don't forget oracle coherence.