Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Functions warmup time

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.

like image 385
Joe Enos Avatar asked Sep 28 '17 16:09

Joe Enos


People also ask

What is the maximum execution time for a cloud function?

In Cloud Functions (2nd gen), the maximum timeout duration is 60 minutes (3600 seconds) for HTTP functions and 9 minutes (540 seconds) for event-driven functions.

What is cold start in Cloud Functions?

Functions are stateless, and the execution environment is often initialized from scratch, which is called a cold start. Cold starts can take significant amounts of time to complete.

Does cloud run have cold start?

While Cloud Run de-couples instance startup and request processing, it can happen that a request must wait for a new container instance to be started to be processed, this notably happens when scaling from zero. This is called a "cold start".

Can we schedule cloud function?

Cloud Scheduler allows you to manage all of your automation tasks in a single place. You do not need to know the intricacies of crontab to manage your running scripts. From a single UI or command-line interface, Cloud Scheduler allows you to view and manage all your jobs.


1 Answers

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.

like image 194
Laurent Avatar answered Nov 08 '22 08:11

Laurent