Pro EP 47 : Stop Using Non Cancellable Queries in .NET Core

Muhammad Waseem
Become .NET Pro !
May 25, 2023

Running complex queries on SQL Server can cause performance issues, such as high CPU usage and memory consumption.

To prevent these problems, it’s important to set up a command timeout for queries.

This will automatically cancel the query if it takes longer than a specified time limit, typically around 5 minutes.Otherwise, the query will continue running until completion.

We can solve this problem by using Async Methods with Cancellation Tokens.

Whenever you’re ready , there are 3 ways I can help you

  1. Subscribe my Weekly .NET Newsletter of C#/.NET with 3000+ Software Engineers.
  2. Promote yourself to 3000+ subscribers by sponsoring my newsletter (Reach me at mwaseemzakir@gmail.com)
  3. Download my eBook at Gum road that contains 30+ .NET Tips (With 2000+ Downloads)

--

--