Keeping the server warm
Zappa enables a feature that keeps AWS Lambda in a warm state. AWS Lambda has a cold start because of containerization, and so Lambda requires that you set up the environment in order to execute functions. Whenever AWS Lambda receives a request, it instantiates the Lambda function along with its required environment and finally destroys the instance after fulfilling the request.
That's how AWS Lambda works. Hence, Zappa implements this mechanism using the AWS CloudWatch event schedule feature in order to keep the instantiated Lambda instance in a warm state. Keeping Lambda in the warm state is nothing but triggering the CloudWatch event as a ping request every four minutes to prevent the destruction of the Lambda instance.
This feature is enabled by default, but if you want to disable this feature, then you can set the keep_warm
flag to false
in the Zappa settings JSON file.
The following code snippet is used to disable the keep warm feature:
{ "dev": { ...