Wednesday 17 March 2010

What does the term sticky session mean in a web-farm scenario?

Sticky session refers to the feature of many commercial load balancing solutions for web-farms to route the requests for a particular session to the same physical machine that serviced the first request for that session. This is mainly used to ensure that a in-proc session is not lost as a result of requests for a session being routed to different servers. Since requests for a user are always routed to the same machine that first served the request for that session, sticky sessions can cause uneven load distribution across servers.

Source : http://dev.fyicenter.com/Interview-Questions/JavaScript/What_does_the_term_sticky_session_mean_in_a_web_.html

What is the downside to sticky sessions with load balancers?

There are two main downsides:

1. Your load isn't evenly distributed. Sticky sessions will stick, hence the name. While initial requests will be distributed evenly, you might end up with a significant number of users spending more time than others. If all of these are initially set to a single server, that server will have much more load. Typically, this isn't really going to have a huge impact, and can be mitigated by having more servers in your cluster.

2. Proxies conglomerate users into single IP's, all of which would get sent to a single server. While that typically does no harm, again other than increasing individual server loads, proxies can also operate in a cluster. A request into your F5 from such a system would not necessarily be sent back to the same server if the request comes out of a different proxy server in their proxy cluster.

Source : http://serverfault.com/questions/46307/what-is-the-downside-to-sticky-sessions-with-load-balancers

Load balancer persistence (sticky sessions)

The Question:
If I have a load balancer in front of three servers (call them A, B, and C) and a client connects to a web service on server B using a WCF http binding that has a session (e.g., wsHttpBinding with sessions enabled), am I guaranteed that I will always communicate with server B until I close the client's proxy?

The Answer:
The answer to my question was "yes" if sticky sessions are enabled (Thanks to Pablo Cibraro MVP).

I discovered that a sticky session is one of several kinds of load balancer persistence and that you will have to check your load balancer's manual to determine what it supports. For example, here is a list of persistent types supported by the F5 load balancer:

* Cookie persistence - uses an HTTP cookie stored on a client’s computer to allow the client to reconnect to the same server previously visited at a web site.
* Destination address affinity persistence - Also known as sticky persistence, destination address affinity persistence supports TCP and UDP protocols, and directs session requests to the same server based solely on the destination IP address of a packet.
* Hash persistence - Hash persistence allows you to create a persistence hash based on an existing iRule.
* Microsoft Remote Desktop Protocol persistence - persistence tracks sessions between clients and servers running the Microsoft Remote Desktop Protocol (RDP) service.
* SIP persistence - is a type of persistence used for servers that receive Session Initiation Protocol (SIP) messages sent through UDP. SIP is a protocol that enables real-time messaging, voice, data, and video.
* Source address affinity persistence - Also known as simple persistence, source address affinity persistence supports TCP and UDP protocols, and directs session requests to the same server based solely on the source IP address of a packet.
* SSL persistence - is a type of persistence that tracks non-terminated SSL sessions, using the SSL session ID. Even when the client’s IP address changes, the LTM system still recognizes the connection as being persistent based on the session ID. Note that the term non-terminated SSL sessions refers to sessions in which the LTM system does not perform the tasks of SSL certificate authentication and encryption/re-encryption.
* Universal persistence - allows you to write an expression that defines what to persist on in a packet. The expression, written using the same TM expression syntax that you use in iRules, defines some sequence of bytes to use as a session identifier.

Other issues to keep in mind:

* Load balancer session timeout value.

Source : http://daveonsoftware.blogspot.com/2007/08/load-balancer-persistence-sticky.html

No comments:

Post a Comment