Advisor | Types of server affinity
Load Balancer Server affinity
Server affinity is a technique that enables the Load Balancer to remember which balanced server was chosen for a certain client at its initial request. Subsequent requests are then directed to the same server again.
If the affinity feature is disabled when a new TCP/IP connection is received from a client, Load Balancer chooses the correct server at that moment and forwards the packet to it. If a subsequent connection comes in from the same client, Load Balancer treats it as an unrelated connection, and again chooses the most appropriate server at that moment.
Server affinity allows load balancing for those applications that need to preserve state across distinct connections from a client at the Web server tier.
WebSphere Commerce does not store client state at the Web server tier. Web servers are only used for serving static content. All dynamic processing is done in the application server tier, where client state is preserved in the form of (HTTP) session objects (which might even be stored persistently in a database). When processing a request in the Web container, cookies are added to the response, containing WebSphere Commerce session information. The client browser resends these cookies with every new request, so that the application server can identify the user based on the cookie values.
While WebSphere Commerce requests may be load balanced to any Web server, server affinity can still be useful for WebSphere Commerce sites:
- For HTTPS, server affinity can be used to avoid repeated SSL handshake processing between the client and different Web servers.
- As a complete Web page is typically retrieved by multiple requests (for example, one for the HTML markup and several subsequent requests for embedded images and other media content), HTTP compression can be used more efficiently if all requests for one page are routed to the same Web server.
- Finally, if all requests within a browser session (or even all requests of the same user across multiple sessions) are processed by only one Web server, access log analysis is easier, as all the information is written to the same log file.
xxxx