Reputation: 1958
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 application 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 information, so for the start there are few questions instead:
(The target platform would be the ubuntu-14.04-x64 Docker image as well as the compilation platform. For develop purposes would be also nice to compile it on Mac OS X_.)
Upvotes: 14
Views: 7031
Reputation: 61
There is a guide for using CrossGen at https://github.com/dotnet/coreclr/blob/master/Documentation/building/crossgen.md. It's a little out of date - I'll see if I can get it updated sometime. The most important part of using CrossGen is to specify the -Platform_Assemblies_Paths switch on the command line, to tell CrossGen the location of all the dependencies that it needs (e.g., System.Private.CoreLib.dll).
Hope that helps. Please let me know if you run into any further issues.
Upvotes: 3
Reputation: 1696
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)
Upvotes: 8