MarkLogic 10 and Data Hub 5.0

Latest MarkLogic releases provide a smarter, simpler, and more secure way to integrate data.

Read Blog →


Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up →

Sticky Session and Session cookie to configure in Load Balancer
08 December 2021 09:14 PM

What is Sticky session and why is it needed?

For client applications that use multi-statement transactions and interact with a MarkLogic Server cluster through a load balancer, it is possible for requests from your application to MarkLogic Server to be routed to different hosts, even within the same session.

This has no effect on most interactions with MarkLogic Server, but operations that are part of the same multi-statement transaction need to be routed to the same host within your MarkLogic cluster. This consistent routing through a load balancer is called session affinity.

How to configure Sticky Session?

Most load balancers provide a mechanism that supports session affinity. This usually takes the form of a session cookie that originates on the load balancer. The client acquires the cookie from the load balancer, and passes it on any requests that belong to the session. The exact steps required to configure a load balancer to generate session cookies depends on the load balancer. Consult your load balancer documentation for details.

For the applications using Java CLIENT API, configure HostId cookie in your requests to preserve session affinity. 

For XCC applications, configure SessionId cookie to preserve session affinity.

Configure these cookies on your Load balancer session affinity configuration for the specific port on which your application is communicating to MarkLogic cluster.

(0 vote(s))
Not helpful

Comments (0)