server affinity is maching a client to the server processing the client's requests in a horizontally scaled arch. load balancing is distributing requests to said servers so they process load in accordance to their capacity. HTH
Joined: Jan 12, 2004
Originally posted by bird cao: what is server affinity
Server affinity refers to the capacity that a server in a cluster is able to service requests from the same HTTP client during its entire session. This is important if the process is stateful. The load balancer usually adds its own Cookie to each request it dispatchers to the server since it gets the first request from the client. The cookie is pushed back to the client with the first response. Thereafter, the client requests carry this cookie (taht identifies the server that services the first response) to the load balancer so that load balancer knows which server it should dispatcher the follwing requests. You buy a hardware load balancer and put it infront of your HTTP server. Load-balancer, DMZ, firewall, or clustering, is not defined in J2EE framework, so I guess it is not that important to know everything in details. They are basically part of infrastructure.
Joined: Feb 11, 2002
In simple sentences, in clustered environment, dispatching(by load balancer) of 1+.. request to same server where HTTPSession info for the client is stored in the memory called is Server Affinity. Server Affinity is required for stateful session bean. In clustered environment HTTPSession management taken care by storing session in database where any server clone can get any httpsession info for any client from database which avoids server affinity. For stateful session bean even after HTTPSession being stored in database,server affinity is required because instance of Stateful session bean is stored in the particular server where first instance is created. Cheers, Prasad