8
votes

Do we know what the warmup/cold-start time is for a function on the new (still beta as of now) Google Cloud Functions? Or the timeout before it cools down again?

I've been trying Azure functions in the per-use mode, and it's been ridiculously bad - seemed inconsistent but I've seen 30 seconds, and it seems to be about 5 minutes of no-use before it cools down again.

I'm assuming Google's functions have the same issue, but I don't see even preliminary documentation on those time periods. The answer seems to be a "ping" every X minutes to keep it alive, but knowing what that X should be would make a difference in billing.

1
Just tried running a function and it had a cold start of about 500ms (beta). It does vary. It would be best if you tested it. Check out the related discussion. stackoverflow.com/questions/42726870/… (firebase cloud functions uses the same tech)Kevin Lee
Yep, so far my testing has shown just a negligible time, but at least with Azure, it was a little inconsistent, so I don't know if I can rely on that. If it's really just 500ms, or even a few seconds, I won't even worry about it. Thanks for the info on Firebase - I've seen documentation on that, but I didn't realize it was the same technology as the new cloud functions.Joe Enos

1 Answers

6
votes

There is an interesting blog post by Mikhail Shilkov, published in August 2018. At this time and based on his experiments, the minimum alive period observed for Google Cloud Functions (GCF) is 3 minutes:

Orange dots are warm and blue ones are cold

As a consequence, using X=2 should be enough to keep a single function warm and ready to serve a request. However, in that case, you should ask yourself whether it is still relevant to use a serverless solution such as GCF.