Miserlou / Zappa

Serverless Python
https://blog.zappa.io/
MIT License
11.89k stars 1.2k forks source link

[Feature] Use lambda-warmer-py decorator to keep more than one lambda instance warm. #1790

Open M0dM opened 5 years ago

M0dM commented 5 years ago

Hi,

Context

I am using python3.6 and I want 100 lambda to be warm at all time.

Expected Behavior

Keep 100 lambda warm to serve 100 requests concurrently without cold-start.

Actual Behavior

Current keep warm implementation is only keeping warm a single lambda instance using lambdawrapper could make this a lot more customizable.

Possible Fix

Wrap lambda function using this project ? https://github.com/robhowley/lambda-warmer-py

M0dM commented 5 years ago

I am trying to make it work on my side. Please see this patch : https://gist.github.com/M0dM/c90360495e9924e7be727054b2a61e4e

The idea is to use lambdawarmer only if dependency is existing inside lambda zip package.

matse004 commented 5 years ago

solves #851

M0dM commented 5 years ago

@mcrowson @jneves What do you think about this ? I would appreciate if this could be merged, (I can create a PR if needed).

ghost commented 5 years ago

Any news on this? This would be really welcome.

MontrealSergiy commented 4 years ago

This might cost you $$$ to keep 100 instance warm. For python, where penalty is mostly bulky libraries/frameworks a better solution is docker checkpoint (RAM dump/load ). While docker-based solution might be complicated for many fullstack coders, who lack devops skills. Thus, if zappa can streamline fighting the cold start with docker, it might be a bomb. Check https://www.imperial.ac.uk/media/imperial-college/faculty-of-engineering/computing/public/1819-ug-projects/StenbomO-Refunction-Eliminating-Serverless-Cold-Starts-Through-Container-Reuse.pdf for in-depth discussion

M0dM commented 4 years ago

This might cost you $$$ to keep 100 instance warm. For python, where penalty is mostly bulky libraries/frameworks a better solution is docker checkpoint (RAM dump/load ). While docker-based solution might be complicated for many fullstack coders, who lack devops skills. Thus, if zappa can streamline fighting the cold start with docker, it might be a bomb. Check https://www.imperial.ac.uk/media/imperial-college/faculty-of-engineering/computing/public/1819-ug-projects/StenbomO-Refunction-Eliminating-Serverless-Cold-Starts-Through-Container-Reuse.pdf for in-depth discussion

Seems promissing thanks for the comment ;)

tzutalin commented 4 years ago

Any update on this? This feature will be very helpful before we can write CouldFormation for this https://devclass.com/2019/12/04/aws-warms-lambda-devs-hearts-promises-end-to-cold-starts/