Search code examples
testingtokenload-balancingdevopsdevelopment-process

Is a new token generated for the same user on different node on a load balancer with stickiness enabled?


My project (on angularJs) implementation is done in a way that a single webpage application is deployed on a load balancer with 2 nodes, I am not able to figure out a solution for the below problem.

Implementation:

  • Each time a user logs in, a new token is created
  • When the user switches to a different node (by any means), the user will need to login again on that particular node

Here is the scenario: (Note: The same User is logging-in from client1, client2 & client3)

Client1 -> lands and logs-in on node1 -> token1 is created
Client2 -> lands and logs-in on node2 -> token2 is created
    Now suppose node1 goes down (due to some reasons), 
Client3 -> lands on node2 by default -> Now,

Note: Since there is a token already generated on node2 for the user and the session here is active too, so

Questions


  1. Should the user be asked for login again on node2? OR
  2. The user should be able to use the current/active session without login?
  3. Why in either case?

Solution

  • I had the same discussion with my development team and here is the answer just in case anyone might need it in the future

    1. Yes, the user should be asked to login again. Why: Because each time the user lands on a node through a different client, a new token will be created.
    2. No, the user will not be able to use the current/active session. Why: Because as soon as the user lands on that node, the new token generated will replace the old one and the hence the user will be asked to login again.
    3. Answered above