A note from 2026: This article was published in 2016. The hybris product is now SAP Commerce Cloud, and the Tomcat/Redis libraries shown here, such as tomcat-redis-session-manager 2.0.0 and Jedis 2.5.2, are very old; validate this pattern against your Commerce Cloud/Tomcat version and current supported session-management options.

Introduction

Let’s start with the session handling basics. When a user logs in, the session is created on one web server in the cluster. On subsequent requests, the load balancer may bounce that user to another web server that doesn’t have that session information. To the user, it appears that they are no longer logged in.

There are two common fixes for this:

As we can see, centralized session storage looks like the universal solution for both sticky and non-sticky sessions. The default hybris does not support centralized session storage, and newer versions support it to an even lesser extent.

Solution

Redis-backed session failover architecture for a hybris cluster

Demo of PoC

Details

JARs (platform\tomcat\lib):

Configuration:

<Context path="/trainingstorefront" ... >
<Valve className="com.orangefunction.tomcat.redissessions.RedisSessionHandlerValve" />
<Manager className="com.orangefunction.tomcat.redissessions.RedisSessionManager"
 host="127.0.0.1"
 port="6379"
 database="0"
 expireSessionsOnShutdown="false"
 notifyListenersOnReplication="true"
/>
<Loader ... />
</Context>

© Rauf Aliev, August 2016