
Snapshots, priming and runtime hooks
Enabling SnapStart moves the JIT cost into the first invocation after a restore rather than removing it. Priming with runtime hooks is what delivers the win, and state captured at init needs care.
GitHub repo
Find the memory setting with the best cost or speed for a function. The benchmark harness from the session runs it against each variant.
Serialization, DI and trimming
Turning on PublishAot surfaced three failures: reflection-based serialization, reflection-based DI, and trimming warnings from the AWS SDK. Source-generated JsonSerializerContext, explicit DI registration and trim annotations fix them.
Earlier sessions and talks
More on SnapStart for .NET, including the re:Invent 2024 session and ASP.NET Core pre-warming.
Session code repository
GitHub repo
Sample code for the session: .NET Lambda cold start optimization with Native AOT and SnapStart.