How do changes to session variables get updated in a cluster?

Consider the situation when two servers are simultaneously processing two separate requests to the same session.

  1. Request(1) comes in and is processed by Server(A)
    a. The session is loaded and the variable equals the value "bar_1".
    b. Then it changes a session variable by executing = "bar_2";

  2. Request(2) comes in and is processed by server(B) while request(1) is still being processed:
    a. The session is loaded, but since Request(1) hasn’t finished, the same session that Request(1) initially loaded will be loaded
    b. The variable equals the value "bar_1"

  3. Request(1) completes
    a. The session is written to the session db and the variable has updated with the value "bar_2"

  4. Request(2) completes - What happens to the variable
    a. Will Lucee see that this request has not changed the value of and therefore will not update it?
    b. Or will Lucee update the entire session, overwriting back to the value “bar_1”?

1 Like

@micstriit Can you help answer @Redtopia’s questions?

1 Like