XPages集群和状态变量 [英] XPages cluster and state variables

查看:53
本文介绍了XPages集群和状态变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们将为XPages应用程序制造另一台服务器.在它前面将有一个故障转移/负载平衡组件(Microsoft Forefront,IBM Web服务器),它将HTTP请求重定向到两个群集服务器之一.

We are about to make another server for XPages applications. In front of it there will be fail over/load balance component (Microsoft Forefront, IBM Web server) that will redirect HTTP request to one of two cluster servers.

我想在发生故障转移的情况下将重新初始化范围内的变量-用户被重定向到其他服务器,这将从头开始(GET)或数据子集(POST)初始化XPage.绑定到bean/作用域变量的所有内容都将丢失(寻呼机状态,特定于应用程序的数据).这可能会给用户带来奇怪的行为:丢失输入的数据或打开意外的页面.我知道事实,这在很大程度上取决于应用程序设计. 这种情况可能与一台服务器上的会话已过期非常相似-在这种情况下如何防止数据丢失.

I suppose that scoped variables will be reinitialized in case of fail over - user is redirected to other server which will initialize XPage from scratch (GET) or subset of data (POST). Anything binded to beans/scoped variables will be lost (pager state, application specific data). This can cause odd behaviour to users: loss of entered data or opening of unexpected page. I am aware of fact, that this is highly depending on application design. The situation can be very similar to expired session on one server - how to prevent loss of data in such case.

是否有任何编码最佳实践,如何避免从服务器到服务器的故障转移的副作用?

Are there any coding best practices how to avoid side effects of fail over from server to server?

推荐答案

虽然不是最佳代码最佳实践,但您首先需要配置负载均衡器,以使用户一旦启动就保持在同一会话上(可能_使用cookie,因此故障转移仅在您的设备真正掉线时发生.

While not a code best code best practise, you first need to configure your load balancer to keep users on the same session once started (probably_ using a cookie, so failover only happens when your box really goes down.

其次,不要将范围变量放在那儿,请始终对其进行测试-无论如何,这都是一个好习惯,因为会话也可能会超时并在单个服务器上释放其变量. POST将由于缺少x会话而失败,因此您可能只求助于可能具有错误处理程序的Ajax进行发布.

Secondly don't take scope variables to be there, always test for them - which is a good practice anyway since a session can timeout and loose its variables on a single server too. POST will fail due to a lack of x-session, so you might resort to posting only via Ajax that can have an error handler.

您可以考虑使用Cookie来捕获状态信息.

You could consider to use cookies to capture state information.

这篇关于XPages集群和状态变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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