在概念上,EJB层上的负载平衡如何在Glassfish /任何ejb容器中运行 [英] Conceptually how does load-balancing on the EJB tier work in Glassfish/any ejb container

查看:109
本文介绍了在概念上,EJB层上的负载平衡如何在Glassfish /任何ejb容器中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想知道如何使用Java EE容器(如Glassfish),负载平衡在EJB级(而不是Web会话复制)上起作用。从我收集的远程接口是一个代理,将您的呼叫委托给您可能在环境中的许多服务器之一。



如果事情失败,他们应该能够在另一台服务器上完成?我想了解这个负载平衡背后的基本理论,为什么它比一堆服务器更好,所有这些服务器都运行一个在负载均衡器上具有会话亲和性的普通Web应用程序?

解决方案


我想在概念上如何
负载均衡工作在EJB级
(而不是Web会话复制)与
Java EE容器,如Glassfish。
从我收集的远程
接口是一个代理,将
委托给您
可能在环境中的许多服务器之一。


你是对的在Glassfish中,初始查找将尝试联系 jndi.properties 文件中列出的服务器之一。然后,服务器知道将用于轮询的群集中的所有其他节点。远程引用(代理)将为您透明地执行此操作。理论上可以动态地从集群中添加/删除节点。请参阅 Glassfish RMI-IIOP负载平衡和故障转移


如果事情失败,他们应该是
能够在另一台服务器上完成? I
想了解基本理论
背后的这种负载平衡,为什么它比一堆服务器
更好一个
运行一个简单的web应用程序
会话亲和性在一个负载平衡器上?


如果bean是无状态的,你甚至不需要任何亲和力,请求可以在任何节点处理。每个远程引用都是自己的负载均衡器。



如果bean是statefull,它更加毛茸茸。集群将尝试维护该bean的2个副本。并且请求是针对这两个副本发送的。如果其中一个节点崩溃,则集群将重新创建另一个副本,直到该节点返回 - 它确实类似于具有会话亲和性的HTTP会话复制。



但相反对于Web服务器,bean是事务组件。因此,如果发生异常,则事务将回滚,并且有状态bean无效,因为其状态可能不再一致。



如Pascal所指出的那样,某种故障有某种故障转移。我的节点不可用,请求可以重新路由到另一个节点。但是如果节点在 时请求被处理,我不知道它是否可以在其他地方重新提交。



如果你想了解更多,建议您阅读 GlassFish高可用性指南 Glassfish中的群集支持


I am wondering conceptually how load-balancing works on the EJB-level (not web session replication) with Java EE containers like Glassfish. From what I have gleaned your remote interface is a proxy that delegates your call to one of many servers you may have in an environment.

If things fail are they supposed to be able to "finish" on another server? I want to understand the basic theory behind this load balancing, why is it better than a bunch of servers all running a plain web application with session affinity on a load-balancer?

解决方案

I am wondering conceptually how load-balancing works on the EJB-level (not web session replication) with Java EE containers like Glassfish. From what I have gleaned your remote interface is a proxy that delegates your call to one of many servers you may have in an environment.

You are right. In Glassfish, the initial lookup will try to contact one of the server listed in the jndi.properties file. The server then know all the other node in the cluster that will be used for round robin. The remote reference (proxy) will do that for you transparently. Theoretically nodes can be added/removed from the cluster dynamically. See Glassfish RMI-IIOP load balancing and fail-over.

If things fail are they supposed to be able to "finish" on another server? I want to understand the basic theory behind this load balancing, why is it better than a bunch of servers all running a plain web application with session affinity on a load-balancer?

If the bean is stateless, you don't even need any kind of affinity and the request can be processed on any node. Each remote reference act as a load balancer on its own.

If the bean is statefull, it's more hairy. The cluster will try to maintain 2 replica of the bean. And the request are dispatched against these two replica. If one of the node crashes, the cluster will recreate another replica until the node is back -- It's indeed similar to HTTP session replication with session affinity.

But on the contrary to a web server, bean are transactional components. So if an exception occurs, the transaction is rolled back and the stateful bean is invalidated because its state may not be consistent any longer.

As pointed out by Pascal, there is some kind of fail-over for certain kind of failure. I the node is not available, the request can re-routed to another node. But if the node fails while the request is processed, I don't know whether it can resubmit it somewhere else.

If you want to know more, I suggest you read Guide to GlassFish High Availability and Cluster Support in Glassfish.

这篇关于在概念上,EJB层上的负载平衡如何在Glassfish /任何ejb容器中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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