Skip to content

Out of Process JIT Compiler Server #44935

Open
@mjsabby

Description

@mjsabby

Background and Motivation

Consider a large monolithic application with a lot of managed code that needs to be JIT compiled. Furthermore, this application is running on hundreds of thousands of servers and each of these servers is redeploying this application multiple times per day. This scenario is going to (in fact already has in many cases) become more common with applications running in ephemeral containers which are shipped in pods with various lifetimes.

It is then wasteful to recompile this application on thousands of nodes. One answer to this problem is precompilation of the managed code in a build environment once and deploy this precompiled code to these thousands of servers. This does, in fact, solve most of the problems and is probably the most ideal solution.

However, it is difficult to precompile all code, and in a large application that has been precompiled a significant chunk of code (depending on the app) can still be JIT compiled.

There are various reasons why JIT compiled code will exist for most applications.

Given this, one way to mitigate the JIT compilation occurring on thousands of nodes could be if there were a cache of this JIT compiled code available at a cost significantly lower than actually JIT compiling the code. For example, a file share or database of precompiled code for that method that can mostly trivially loaded into the running program.

This desire to have a code cache then necessitates a different lifetime than the process where the code will be needed and therefore it has to be out of process.

Proposal

The proposal is to have a system that could provide this functionality and do it in a way such that the target process could request through some mechanism the code or method to be compiled and that the compiler server can facilitate this either by storing it in some form, delegating it to a 3rd party, or actually generating the code -- or a combination there of.

Prior Art

I'm only aware of LLVM's Orc subsystem which has similar goals to what this issue is proposing, the ability of generate code in a different process than the process where code is intended to be used in.

Risks

Specialized niche use case & too complicated for most .NET customers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions