JGroups - User session

Hi,

I’d like to confirm a CUBA cluster behavior.

What I have done so far
1.) Setup 2 servers (webname, host1 and host2 ) with local.app.properties
2.) Configure Jgroup
3.) start both server and login each application

I see the users session exists 2 at user sessions screen. Is it correct behavior? I’m expecting both nodes are sharing the same session. It means 1 record in user sessions screen

Please advise

Regards,
CK

Hi,
There will be one session when you will introduce a load balancer that distributes sessions (with sticky session or ip-hash strategy) and hides two servers behind one domain name.

If you login two times using different http://server1:8080/myapp and http://server2:8080/myapp URLs - of course these are two separate sessions.

Hi Alexander,

My setup is single war (I’m sorry, I didn’t mention at above)

I follow below guide and set to true. I understand this parameter is to sync user session between both nodes.

cuba.syncNewUserSessionReplication = true

https://doc.cuba-platform.com/manual-7.2/cluster_mw_server.html#cluster_mw_server_sync_session_repl

Even, we set this to TRUE but we are using different URL. The user sessions would have 2 because the user session is generated at web client block, right?

Regards,
CK

Hi Alexander,

Another question on Clustering. How do we know which node running scheduler task if we set scheduler task to singleton?

Regards,
CK

It doesn’t matter.

No, this parameter is to turn on synchronous replication of user session, instead of asynchronous which is the default. If you are using single war, then this parameter is not applicable to your configuration at all.

  • You will get two user sessions if you login two times.
  • You will have to login two times if you access web servers through different URLs.
  • You need a load balancer to hide cluster nodes between one URL.
1 Like
  1. You should assign different cuba.webHostName property values to cluster nodes. See Appendix B: Application Properties - CUBA Platform. Developer’s Manual
  2. Web host name property is used by CUBA to create a Server ID property: Server ID - CUBA Platform. Developer’s Manual
  3. Scheduling engine uses Server ID for tasks coordination and as an identifier in the logging (“Server” attribute in the Scheduled Task → Execution History screen).
1 Like

No, this parameter is to turn on synchronous replication of user session, instead of asynchronous which is the default. If you are using single war, then this parameter is not applicable to your configuration at all.

How about this flag? Do I need to set if single war

cuba.rest.syncTokenReplication = true

This flag also doesn’t relate to the problem you’ve described in this topic.

Hi Alexander,

Understand the flag doesn’t related to above question. We are planned to test CUBA API on Cluster - Just to know the behavior before test.

Does the user token on node A will replicate to node B ?

Regards,
CK

The user token will replicate in both states. The replication will be synchronous or asynchronous, depending in the flag.
The flag may be essential to enable if you plan to use REST API with round-robin balancing (such balancing strategy can be used by REST clients, not for Web UI).

1 Like