Book Image

WildFly Configuration, Deployment, and Administration - Second Edition

Book Image

WildFly Configuration, Deployment, and Administration - Second Edition

Overview of this book

Table of Contents (19 chapters)
WildFly Configuration, Deployment, and Administration Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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

RoundRobin

It is the default load-balancing policy. The smart proxy cycles through a list of WildFly Server instances in a fixed order.

RandomRobin

Under this policy, each request is redirected by the smart proxy to a random node in the cluster.

FirstAvailable

It implies a random selection...