ARTICLE AD BOX
I have an ASP.NET Core 10 application using EF Core 10 with SQL Server 2017.
Problem:
Queries work normally when the app starts.
After the app is idle for a few minutes, all EF Core queries become extremely slow (cold start).
This affects all queries, not a single one.
I have tried:
DbContext pooling (AddDbContextPool)
Query splitting (UseQuerySplittingBehavior(QuerySplittingBehavior.SplitQuery))
Compiled queries and other projection optimizations
None of these consistently resolve the issue.
Current workaround:
I implemented a hosted service that executes a trivial SQL query periodically (every 10 seconds) to keep the connections alive. This prevents the idle cold-start slowdown, but I am aware it may not be considered best practice.
Questions:
Is using a keep-alive hosted service safe and acceptable for production in EF Core 10 / ASP.NET Core 10?
Are there recommended approaches to avoid idle cold-start performance issues without relying on a keep-alive loop?
What techniques are commonly used in production to mitigate cold-start performance problems with EF Core and SQL Server?
