PublishReadyToRun configuration for trimmed low-traffic workloads
0 reputation · 20 May 2023, 11:42 UTC
Reducing cold-start latency in low-traffic environments often involves using ReadyToRun (R2R) compilation to minimize Just-In-Time (JIT) overhead during application initialization. This requires specifying a precise Runtime Identifier (RID) to ensure native code compatibility with the target host.
When combining PublishReadyToRun with trimming to minimize the deployment footprint, there is a potential conflict regarding reflection-based members. If the trimmer removes metadata that the pre-compiled native code expects to find at runtime, the application may encounter unexpected failures that are not present in standard JIT-compiled builds.
Given a .NET 6+ environment targeting a specific Linux distribution:
- How does the interaction between
PublishReadyToRunandTrimMode=partialaffect the stability of reflection-heavy libraries? - Which specific RID constraints are necessary to ensure the R2R binaries remain compatible across minor OS kernel updates?