Solving Tricky Coordination Problems in Stateless .NET Services
Developing modern, service-oriented architectures requires that our services become stateless to enable horizontal scalability. ASP.NET helps in doing so with IDistributedCache, but caching is only one of many new coordination problems.
In this session I will present how to approach some coordination problems, with a deeper focus on using Redis Pub/Sub to prevent concurrent client requests from triggering the same online-but-expensive computation over and over, by creating a distributed lock that does the job once and instantly notifies all other pending requests when the computation is completed.
This type of computation-locking is useful for preventing “stampedes” when generating reports, serving AI models, running serverless functions, and more.
During the presentation I will also demo a sample ASP.NET Core project that implements said mechanism by making full use of asynchronous code and System.Collections.Concurrent to maximise performance.