Sticky session

Sticky session routing is generally used because of a business use case. The idea is to always route a client to the same backend server if a session is started. Java EE defines three session modes through SessionTrackingMode:

  • COOKIE: The session is tracked through its identifier (JSESSIONID) inside cookies, so it hits the browser (client) and is sent with each request in the cookies.
  • URL: The JSESSIONID is sent to the client through the URL. Example: http://sample.packt.com/quote-manager/index.html;jessionid=1234
  • SSL: This uses the HTTPS native mechanism to identify sessions.

Each time, the tracking works by passing a shared identifier between the client and the server. If you add a load balancer in between, the communication ...

Get Java EE 8 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.