Clustering session beans
In Chapter 3, Configuring Enterprise Services, we discussed the difference between Stateless Session Beans (SLSBs), Stateful Session Beans (SFSBs), and Singleton Session Beans.
SLSBs are not able to retain state between invocations, so the main benefit of clustering an SLSB is to balance the load between an array of servers:
@Stateless @Clustered public class ClusteredBean { public void doSomething() { // Do something } }
If you want to further specialize your SLSB, then you can choose the load-balancing algorithm used to distribute the load between your EJBs. The following are the available load-balancing policies for your SLSB:
Load-balancing policy |
Description |
---|---|
|
It is the default load-balancing policy. The smart proxy cycles through a list of WildFly Server instances in a fixed order. |
|
Under this policy, each request is redirected by the smart proxy to a random node in the cluster. |
|
It implies a random selection... |