vaadin / kubernetes-kit

Other
2 stars 3 forks source link

Verify demo project scaling on a kubernetes-scaling based prototype #19

Closed mcollovati closed 1 year ago

mcollovati commented 1 year ago

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).

mcollovati commented 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

Some additional notes:

Artur- commented 1 year ago

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

Artur- commented 1 year ago

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

Artur- commented 1 year ago

There seems to be a VaadinService.PRESERVE_UNBOUND_SESSION_ATTRIBUTE flag to handle this case which basically skips all logic

heruan commented 1 year ago

Done in https://github.com/vaadin/azure-kit/pull/20