在文档 Websphere Application Server Information Center - Clustered session support 中,它说
The session management facility requires an affinity mechanism so that all requests for a particular session are directed to the same application server instance in the cluster. This requirement conforms to the Servlet 2.3 specification in that multiple requests for a session cannot coexist in multiple application servers.
是不是说Websphere只能支持粘性 session (session affinity)机制?如果没有,如何在 Websphere 上配置以支持非粘性 session 策略?
在 Servlet 2.3 specification, SRV.7.7.2 Distributed Environments 中
Within an application marked as distributable, all requests that are part of a session must handled by one virtual machine at a time.
根据这个规范,它假设我们应该遵循这个规则,但是我们可以在Apache + Tomcat集群上使用非粘性 session 策略,这不是违反规则吗?
欢迎任何回复。
最佳答案
关于您的第二个问题:如果您在 Apache 服务器后面使用 Tomcat,则您使用的组件(Apache 服务器)不符合 JEE,因此它不必遵循任何 JEE 规则。
关于您的第一个问题,对于 Websphere,您可以在使用代理服务器、HTTP 插件和实现您自己的代理解决方案之间进行选择:
http://www.ibm.com/developerworks/websphere/techjournal/1010_pape/1010_pape.html
您可以通过 plugin-cfg.xml 文件中的 CloneiD 属性忽略 session 关联
CloneID (zero or one attribute for each Server) If this unique ID is present in the HTTP cookie header of a request (or the URL if using URL rewriting), the plug-in routes the request to this particular server, provided all other routing rules are met. If a CloneID is not specified in the Server, then session affinity is not enabled for this server.
关于java - Servlet 2.3规范中关于Websphere session 管理策略和 session 相关内容的一些疑问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20947495/