Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to pre-warm the app?

When you run dotnet run on your MVC6 application it takes long time on first request but then it's obviously works fine. I've tried to find answers in google but it's impossible because all I get is articles about IIS which I am not using at all. In fact I run the code on Ubuntu.

Is it possible to pre-warm the dotnet run so the first request will be as fast as the second?

like image 936
Stan Avatar asked Jun 07 '16 09:06

Stan


1 Answers

A few suggestions:

  1. Use the Release build so the code is optimised for production use rather than debugging (dotnet run --configuration Release)
  2. Initiate the first connection yourself, therefore all subsequent requests from your clients are "warm"
  3. Compile using the --native flag, then host the results to further benefit from performance optimisation

Lastly (and this point is pure speculation), potentially look at running your published web site in a production web server host (e.g. Apache or IIS) rather than from the dotnet cli. This may provide performance enhancements, but would certainly offer "warming" features that aren't present in the CLI (I know IIS has an Always-On option).

like image 178
tommed Avatar answered Oct 16 '22 03:10

tommed