In this video, we are going to learn a lot the execution environment and lambda lifecycle.
One least lambda invokes our function.
It creates an execution environment in order to isolate it.
Runtime environment.
The execution environment provides the required resources for running our function.
The execution environment also provides lifecycle support for the functions, runtime and any external
extensions associated with our function.
You can find the image in the slide, which is an example invocation to lambda function and see how
execution environment created and managed by the ADA is.
Basically the function communicates with lambda runtime using the runtime API.
Extensions communicate with Lambda using the extensions API and extensions can also receive log messages
from the function by subscribing to logs using the logs API before lambda creates execution environments,
it is looking to lambda configurations like amount of memory, CPU usage and maximum execution time
settings.
According to these settings and configurations, lambda creates an execution environment.
So Lambda.
If you locate the lambda execution movement lifecycle, there are several phases when Lambda Invocation
performs.
You can find the image in the slide.
There are three main phases which are init invoke and shutdown process in the init phase.
Lambda performs three tasks.
Start all extensions, bootstrap the runtime and run the function static code.
The init phase ends when the runtime and all extensions are ready by sending a next API request.
The interface is limited to ten second.
If all three tasks don't complete within the three second ten second.
Lambda retries the init phase at the time of the first function invocation and the second phase is invoke
phase.
In this phase, Lambda invokes the function handler after the function runs to completion.
Lambda prepares to handle another function invocation.
The functions timeout setting limits the duration of the entire invoke phase.
For example, if you set the function timeout as 5 minutes, the function and all extensions need to
complete within the five minute.
119.
The function is invoked.
After that, it goes to the next API request in order to invoke another function execution.
And the last phase is the shutdown phase.
In this phase is triggered if lambda function doesn't receive any invocation for a period of time in
the shutdown phase, lambda down the runtime and that's the extension to let them stop cleanly and then
removes the entire environment.
Lambda sends a shutdown event to each extension, which tells the extension that the environment is
about to shutdown.
As you can see that we have understand the lambda execution environment and how Lambda Lifecycle works.