Decouple Long-running Tasks from HTTP Request Processing — Using In-Memory Message Broker

Part 2 : Discuss the simplest implementation to decouple long-running tasks by using an in-memory message broker and an in-process worker that completes the tasks asynchronously.

Shawn Shi
Geek Culture

--

System Diagram by Author

Background

In my previous article, I built upon the Microsoft documentation on ASP.NET Core Performance Best Practices, and discussed how long-running tasks could be decoupled from the regular HTTP request processing in a REST API application at a conceptual / system design level. We also came up with a system design using a smart coffee machine as an example and explained the improved workflow, please see the system diagram above.

Just like a new project at work, when the design is signed off by the manager / tech lead, we will start implementing the design. Most likely, we would take an iterative approach by building a MVP (minimal viable product) as a prototype and build upon the MVP version.

Let’s build our MVP version. This is article #1 of our implementation journey, and please stay tuned for follow-up articles.

Goal

--

--

Shawn Shi
Geek Culture

Senior Software Engineer at Microsoft. Ex-Machine Learning Engineer. When I am not building applications, I am playing with my kids or outside rock climbing!