What does the term sticky session mean and how is it achieved?

Solution Verified - Updated -

Environment

  • JBoss Enterprise Application Platform
    • 5.x
    • 6.x
    • 7.x
  • mod_cluster
  • mod_jk
  • mod_proxy_balancer

Issue

  • What does the term sticky session mean and how is it achieved?

Resolution

  • 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.
  • Sticky sessions is most commonly maintained by the session's jvmRoute (used my mod_jk, mod_cluster, and mod_proxy_cluster). When JBoss creates a session, it creates it in the format "id.jvmRoute". The jvmRoute serves as an identifier for that node so all subsequent requests for a session are stickied and sent straight to the node indicated by the jvmRoute in the session cookie. If the request fails over from one JBoss node to another, then JBoss will update the client's session cookie so that their session's jvmRoute matches the new node they failed over to.
  • Other third party load balancers may maintain sticky sessions instead by remember the client ip address and which backend server that client was sent to originally.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments