Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling .net core app with CoreRT / another AOT

I'm building an REST API on ASP.NET CORE 1.0. In production it'd be IMHO very useful NOT to use JIT because the docker containers with the app are scaling up and down, redeploying during CI over and over, so the just-in-time compilation for every deployed container causes terrible lags, LB health-check deaths and other pains.

As I read, the native compilation with dotnet CLI is discontinued. I tried building with CoreRT but without luck (details on demand due to complexity).

Since this question is quite abstract I'm not providing sample codes or detailed info, so for the start there are few questions instead:

  1. Is my presumption correct - will ahead-of-time compilation solve the problem with slow first execution of each path -or - isn't there any other solution anyway?
  2. If it's true, is currently possible to build "native" app (ubuntu x64 target) from .NET Core?
  3. If it's, what's the best practice - how can I do it? Does anyone has experience with that?

(The target platform would be ubuntu-14.04-x64 docker image as well as the compilation platform. For develop purposes would be also nice to compile it on OSX.)

Thank you in advance.

like image 978
rudolfdobias Avatar asked Oct 18 '16 02:10

rudolfdobias


Video Answer


1 Answers

Having full native ahead of time compilation isn't possible at this time. It's one of the goals of the CoreRT project linked above but isn't in any state I'd call production ready. The demo at Connect last year should be taken with a pretty big grain of salt. For example they still don't have a reflection subsystem. However, we have a couple of solutions that can greatly reduce the amount of code needing to be generated at JIT time. For .NET Core the tooling is called CrossGen and it's pretty baked these days.

While I have your attention I'll also mention that we're working on an evolution of the NGEN/CrossGen format that alleviates a big chunk of the typical pain involved with typical ni files. That goes under then name ReadyToRun

Hope that helps. Let me know if you have other questions.

Disclosure: I work on the .NET Native runtime and compiler team for UWP (a sister project to CoreRT and LLILC etc)

like image 91
MattWhilden Avatar answered Sep 24 '22 18:09

MattWhilden