Skip to content

Ability to reload AWSOptions after ASP.NET Core Lambda Startup #219

Answered by ppittle
IgorPietraszko asked this question in Q&A
Discussion options

You must be logged in to vote

Lambda & Singletons

Yes, Lambda MAY keep a recently used instance to serve the next incoming request. This is known as a Warm Start and allows the lambda function to respond much quicker.

In the case of ASP.NET, this means the Web Host persists between requests. As does the IServiceCollection that is populated in Startup.ConfigureServices. Anything added as a Singleton in the initial request will therefor survive into subsequent requests.

You can see this by adding a Singleton binding in Startup

public class SingletonModel
{
    public string Data { get; set; }
}

public void ConfigureServices(IServiceCollection services)
{          
    services.AddSingleton<SingletonModel>(new Singleton…

Replies: 20 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ashishdhingra
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
guidance Question that needs advice or information. module/cog-id-provider
3 participants
Converted from issue

This discussion was converted from issue #210 on April 05, 2022 22:54.