Sitemap
Geek Culture

A new tech publication by Start it up (https://medium.com/swlh).

REST API Best Practices — Decouple Long-running Tasks from HTTP Request Processing

Part 1 : Discuss how to design and complete long-running tasks outside of HTTP requests in RESP API, as recommended by Microsoft on ASP.NET Core Performance Best Practices.

6 min readJun 7, 2021

--

Press enter or click to view image in full size
Photo credit to Mike van den Bos on unsplash.com

Background

Most applications have some tasks that take longer than normal to complete. These tasks can be to generate a complex ad-hoc report for downloading, to trigger and wait for a CPU-intense computation, or to perform a series of small tasks that add up the whole processing time. Although there is no absolute definition on the processing time for a normal HTTP request, the expectation of modern applications is just high from the end users. While the default ASP.NET Core HTTP timeout is 100 seconds, it’s not something we want to rely on. Anything that takes more than a few seconds seem to be too long for a regular user, me included.

Microsoft documentation has a great article covering ASP.NET Core Performance Best Practices, and one specific subject is on Complete long-running Tasks outside of HTTP requests. Here is a link if you’d like to read the full article. In a nutshell, the recommendation is “Do not wait for long-running tasks to complete as part of…

--

--

Shawn Shi
Shawn Shi

Written by Shawn Shi

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!

Responses (5)