Code for cold and warm containers

The performance of the lambda function is dictated by the logic that we code within it and the dependencies we call. So the best practice to code the lambda function would be to consider the cold and warm start of the containers.

For improved performance for warm starting the container, make sure that you store and reference any externalized configurations or dependencies that your code retrieves locally. Limit the reinitialization of the variables/objects on every invocation that uses global and static variables. Keep the HTTP and database connections alive.  

For better performance for cold starting the container, it is always better to use the default network environment, unless connectivity to a resource ...

Get DevOps for Serverless Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.