[Clarification] What is prewarm actually doing?
kaldown opened this issue · 1 comments
Hello.
Thank you for the great plugin.
I read the documentation and there are still question for me for a certain argument: prewarm.
Reading this line I concluded that this will start first warmup request for the given function. Instead waiting for the scheduler to take place.
Now I'm not sure I understand it correctly. Could you please clarify if I have to set prewarm: true to warmer to work at least?
Because this exmplanation now leads me to the conclusion that I have to prewarm functions myself after deploy.
Could I omit prewarming if I only need to warmup to take place upon my schedule (cron for instance)?
Thank you.
Prewarm simply invokes your warmers right after the deployment.
This means that all your lambdas that have a warmer setup will be invoke (1 or more times based on the concurrency setting).
This is good to avoid cold start right after deploying.
Also, if at any point in time you want to call the warmers you can use the prewarm option of the cli.
# Either invoking all warmers
serverless warmup prewarm
# some specific one
serverless warmup prewarm -warmers <warmer_name>
# some several
serverless warmup prewarm -warmers <warmer_name>,<another_warmer_name>
If you only need the warmers to run based on your schedule, you don't need prewarm.