user567
user567

Reputation: 3862

Deploy function with long running time on Google Cloud Run

If I understood it well, Google Cloud Run will make an API publicly available. Once a request is received, an instance is started and the job is processed. Once the job done, the instance will be terminated. Is this right?

If so, I presume that Google determine when the instance should be shutdown when the HTTP response in sent back to the client. Is that also right?

In my case the process will run from 10 to 20 Minutes. Can I still send the HTTP response after so much time? Any Advice on how to implement that?

Upvotes: 0

Views: 1107

Answers (1)

somethingsomething
somethingsomething

Reputation: 2164

Frankly, all of this is well documented in the cloud run docs:

  1. Somewhat, but this depends on how you configured your scaling https://cloud.google.com/run/docs/about-instance-autoscaling
  2. Also see above, but a request is considered "done" when the HTTP connection is closed (either by you or the client), yes
  3. 60 mins is the limit, see: https://cloud.google.com/run/docs/configuring/request-timeout

Any Advice on how to implement that?

You just keep the connection open for 20mins, but do note the remark on long living connections in the link above.

Upvotes: 2

Related Questions