XPages集群和状态变量

编程入门 行业动态 更新时间:2024-10-22 14:04:04
本文介绍了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集群和状态变量

本文发布于:2023-11-25 14:02:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1630048.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:集群   变量   状态   XPages

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!