Integration of Cuba Platform with Redis for Session Storage in Multi-Replica Setup

Hello Cuba Platform Community,

I am currently working on a project where we are using the Cuba Platform, and we have set up multiple replicas of our application for high availability. To manage session consistency across these replicas, we are looking to integrate Redis for session storage.

I would greatly appreciate it if anyone could provide guidance or a step-by-step tutorial on how to configure Cuba Platform to use Redis for storing sessions. Specifically, I am interested in understanding:

  1. The necessary configurations in the Cuba Platform to enable Redis session storage.
  2. Any required dependencies or libraries that need to be included.
  3. How to handle session replication and failover scenarios.
  4. Best practices for managing session data in a multi-replica environment using Redis.

Any examples, documentation, or pointers to relevant resources would be extremely helpful.

Thank you in advance for your support!

Best regards

Can anybody help me? :smiling_face_with_tear:

Hi,

If you plan to utilise external storage for HTTP (web) sessions, that I am afraid you wouldn’t be able to to that.
It is because Vaadin UI stores all UI in the web session, and this session is too big in size, so one can’t set up session replication (it would be too slow and resource consuming, hundreds of KB transferred back and forth after every http request).

However, if you want to scale your application horizontally, you can do that. You will need sticky-session balancer though.
Also you’ll need additional setup for the cluster, to synchronize some middleware caches (including user sessions cache). The default and the simplest option to configure is to set up JGroups. The documentation is here: Configuring Interaction between Middleware Servers - CUBA Platform. Developer’s Manual

See also Session Expired error when on more than one pod on Kubernetes load balancer - #2 by albudarov