1

It's known for a long time that the first request that goes to a .NET's app takes a long time to response, sometimes so long that it hugely degrades UX and causes customers to go away.

And almost all solutions to this are just about keeping the application live either by polling it at an interval, or by changing idle time of IIS, etc.

Now I'm wondering if there is a mechanism that we can reduce coldstart time systematically, not by hacking into it?

  • 2
    Cold start is unavoidable, .NET won't runt without it, just make sure not to contribute to it, e.g. don't preload lots of data too soon. **[This answer](https://stackoverflow.com/a/41736984/1220550)** shows what we usually do to keep things snappy (the other answers there also may be of help). Also I wouldn't call this hacking, I'd rather call it professional server management. – Peter B May 24 '18 at 08:41

1 Answers1

1

There are a few options here:

When hosted in IIS, disable the idle time, restart etc. Also note that IIS won't start an asp.net core app automatically without an incoming request. Setting up a poll task is a option here.

.NET Core 2.1 has better startup performance, with an additional option to enable tierd JIT compilation (see this GitHub issue).

Also note that startup time is further degraded the more intensive work you do on startup. E.g. doing EF Core database migrations etc.

Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217