鉴于 JavaServer Faces 在服务器端本质上是有状态的,建议使用哪些方法来水平扩展 JSF 2.0 应用程序?
如果一个应用程序运行多个 JSF 服务器,我可以想象以下场景:
- Sticky Sessions: send all requests matching a given session to the same server.
-
问题:通常使用什么技术来实现这一目标?
-
Problem:服务器故障会导致会话丢失......并且通常看起来像是脆弱的架构,尤其是在重新启动时(不尝试扩展现有应用程序)
- State (Session) Replication: replicate JSF state on all JSF servers in cluster
-
问题:通常使用什么技术来实现这一目标?
-
Problem:无法扩展。集群总内存=最小服务器上的总内存
- Instruct JSF (via configuration) to store its state on an external resource (e.g. another server running a very fast in-memory database), then access that resource from the JSF servers when application state is needed?
- Instruct JSF (via configuration) to be stateless?
[EDIT]
更新以响应 Ravi 对粘性会话的建议
这可以通过在粘性会话模式下配置负载均衡器来实现。
More info http://shlomoswidler.com/2010/04/elastic-load-balancing-with-sticky-sessions.html
这样,您的所有后续请求都会发送到同一应用程序服务器。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)