Closed mcollovati closed 1 year ago
I've pushed the branch issues/19-custom-session-handling
that imports kubernetes-scaling
prototype into Azure Kit.
The project still has dependencies on spring session artifacts, but only to preserve existing configuration and transitive dependencies on redis and hazelcast. However, the Spring Session Filter is disabled in the demo and is replaced by the custom SessionTrackerFilter
Actual implementation requires a patched Flow version 23.3.sess-SNAPSHOT
, so also Vaadin version has been upgraded to 23.3-SNAPSHOT
.
The demo works fine on local cluster with both Redis and Hazelcast as backend storage. Also, PUSH (XHR+websocket) is working correctly.
Here some opinions
pros
HttpSession
provided by the container, so PUSH and closures works without any problemcons
HttpSession
but not VaadinSession
)AtmospherePushConnection.send
)HttpServletRequest.changeSessionId
? Do we need a HttpSessionIdListener
?Some additional notes:
SessionChangedEvent
on VaadinSession.unlock()
only when there are actual changes, would help in deciding whether or not to serialize the session.Serialization is performed by our component and not delegated to the backend. We may lose customizability and potential performance improvements provided by Redis, Hazelcast, etc.
I wonder if we could still delegate the serialization part to Spring Session?
Tracking is limited to UIDL requests, should be extended to other kinds of request (e.g. stream resources) or perhaps to every request (user may have custom code that changes HttpSession but not VaadinSession)
If the timestamps are stored in the session, maybe we can use that to see if we need to serialize it or not.
Session expiration should perhaps be handled on backend store
Expiration should delete the session from the backend store. It was not in the prototype
This logic is probably invalid if you want to serialize the session, populate it again and keep using it on the same host https://github.com/vaadin/flow/blob/c802dbe7c096baf756bd079ce029bdb5b601da53/flow-server/src/main/java/com/vaadin/flow/server/VaadinSession.java#L185-L218
There seems to be a VaadinService.PRESERVE_UNBOUND_SESSION_ATTRIBUTE
flag to handle this case which basically skips all logic
Create a spike branch with an application scaling prototype base on Artur's work (https://github.com/Artur-/kubernetes-scaling) and compare pro/cons with the SpringSession approach (branch spikes/spring-session-workarounds).