Server affinity
Your load distribution facility is not always free to pick any available server when it redirects client requests. In some cases, a particular server is better suited to process the request.
For stateful session beans or entity beans within the context of a transaction, there is only one valid server. An entity bean is instantiated on a single server in a single container during the context of a transaction. Subsequent client requests must be directed to that server. Workload management always directs client requests to a stateful session bean to the single server instance that contains the bean. In either case, directing the request to the wrong server either causes the request to fail or forces the server to forward it to the correct server at a high performance cost.
Persistent session data can be stored in a database or shared among clustered application servers as in-memory sessions. For clustered HTTP sessions between transactions, this data ensures that any available server can be used to process client requests.
For stateless session beans, any available server can be used because each bean instance is identical.
Server affinity refers to the characteristics of each load distribution facility that takes these constraints into account. The load distribution facility recognizes that multiple servers can be acceptable targets for a request. However, it also recognizes that each request can be directed to a particular server where it is handled better or faster.
Server affinity can be weak or strong.
Weak server affinity
The system attempts to enforce the desired affinity for the majority of requests, but does not always guarantee that this affinity will be respected.Strong server affinity
The system guarantees that affinity is always respected and generates an error when it cannot direct a request to the appropriate server.