Session state loss during Blue-Green deployment in ASP.NET Core
0 reputation · 20 Sept 2024, 01:12 UTC
The goal is to maintain user session data when traffic is switched from the existing (Blue) environment to the updated (Green) environment during a Blue‑Green deployment of an ASP.NET Core application, aiming for zero downtime.
Constraints include using the default ASP.NET Core session middleware with its in‑memory provider, a load balancer that can route requests without sticky sessions, and the need for session serialization to be compatible across the old and new application versions. There is uncertainty about whether the session payload produced by the current version can be deserialized correctly by the new version, and whether an external Redis store eliminates the risk of session loss when sticky sessions are disabled.
Does ASP.NET Core’s session middleware preserve session data when routed to a new instance without sticky sessions? Is the default JSON serializer used for session state compatible across minor version upgrades of the application? What Redis configuration is required to guarantee session persistence during a Blue‑Green cutover?