Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Data Protection in Depth: The Key Ring, Rotation, Key Storage, Encrypting Keys and Multiple Instances
Random logouts and empty-bodied 400s in a multi-instance ASP.NET Core app usually come from a separate Data Protection key ring per instance. Using real logs, we cover the key ring lifetime, rotation and revocation, the purpose hierarchy, file, Redis and database stores, encrypting keys with a certificate and the role of SetApplicationName.
Prerequisites for Zero Downtime: Graceful Shutdown, Readiness, Stateless Apps and Backward Compatibility
No deployment strategy can save an app that doesn't finish its work when stopping and doesn't tell the truth about being ready. With real runs: a 5 s request is cut with an RST when ShutdownTimeout is 2 s, Docker's 1 s wait produces exit code 137 (SIGKILL), readiness returns 503 during the drain while the API keeps serving 200, separate Data Protection key rings throw CryptographicException, and a deleted Angular chunk turns into a ChunkLoadError.
From One Server to Millions of Users: Vertical and Horizontal Scaling and the Stateless Tier
The precondition for scaling the application tier horizontally is being stateless: session, the Data Protection key ring, IMemoryCache, local files and scheduled jobs must move outside the instance. In a real two-instance experiment moving session to Redis alone fixes nothing, because session and authentication cookies are encrypted with Data Protection keys; once the key ring is shared too and SetApplicationName is set, the two servers behave like one application.