JSF 2.0应用程序的水平缩放 [英] Horizontal scaling of JSF 2.0 application

查看:101
本文介绍了JSF 2.0应用程序的水平缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于JavaServer Faces在服务器端具有固有的有状态性,建议使用哪些方法来水平扩展JSF 2.0应用程序?

Given that JavaServer Faces is inherently stateful on the server side, what methods are recommended for horizontally scaling a JSF 2.0 application?

如果一个应用程序运行多个JSF服务器,我可以想象以下情形:

If an application runs multiple JSF servers, I can imagine the following scenarios:

  1. 粘性会话:将与给定会话匹配的所有请求发送到同一服务器.
    • 问题:通常使用什么技术来实现这一目标?
    • 问题:服务器故障会导致会话丢失...并且通常看起来像是脆弱的体系结构,尤其是在重新启动时(不尝试扩展现有应用程序)
  1. Sticky Sessions: send all requests matching a given session to the same server.
    • Question: what technology is commonly used to achieve this?
    • Problem: server failure results in lost sessions... and generally seems like fragile architecture, especially when starting fresh (not trying to scale an existing application)
  • 问题:通常使用什么技术来实现这一目标?
  • 问题:无法扩展.群集的总内存=最小服务器上的总内存
  • Question: what technology is commonly used to achieve this?
  • Problem: does not scale. total memory of cluster = total memory on smallest server
  • 问题:这可能吗?
  • Question: is this possible?
  • 问题:这可能吗?
  • Question: is this possible?

已更新,以响应Ravi的粘性会议"建议

Updated in response to Ravi's suggestion of Sticky Sessions

推荐答案

这是Jelastic PaaS的一个想法:

Here's an idea from Jelastic PaaS:

在2个服务器群集中配对应用程序实例,并在一个群集中的这2个实例之间应用会话复制.然后,您可以根据需要添加任意数量的2实例集群,并在集群之间进行负载均衡请求,每个会话都将保留其起源的集群.在群集内,请求可以在实例之间进行负载均衡.

Pair-up application instances in 2-server clusters, and apply session replication between those 2 instances within one cluster. Then you can add as many 2-instance clusters as you want and load balance requests between clusters, with each session sticking to the cluster it originated from. Within cluster, requests could be load balanced between instances.

这种方式具有一定程度的故障安全性,因为如果集群中的一个实例发生故障,则另一个实例将以相同的会话状态接管.另一方面,内存影响不如完全复制那么严重.

This way there is some degree of fail safety, since if one instance in cluster fails, the other takes over, with same session state. On the other hand, memory impact is not as severe as with full replication.

简而言之,它是您问题中的1.和2.的组合.当然,如果可用性更受关注,则每个群集中可以有两个以上实例.

In short, it is combination of 1. and 2. from your question. Of course, there can be more than 2 instances in each cluster, if availability is of greater concern.

与Jelastic文档的链接我提出了以下想法: http://jelastic.com/docs/session-复制.

Link to Jelastic docs I lifted the idea from: http://jelastic.com/docs/session-replication.

免责声明:我实际上不知道如何使用JSF2进行配置,并且与Jelastic无关.只是喜欢这个想法,并认为这可能会有所帮助.

Disclaimer: I don't actually know how to configure this with JSF2, and have no affiliation with Jelastic. Just liked the idea and thought it might help.

这篇关于JSF 2.0应用程序的水平缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆