0

I'm planning to move my application to google-cloud-run, and trying to understand what is doable and what parts of the applications needs to be redesigned. The application should be started when data is available, process all new data which becomes available while executing and then go to sleep.

I have seen some questions and a few answers about graceful shutdown for a cloud run instance. My application would ideally need upto 90 seconds to make a graceful shutdown. Is it possible to change the 10 seconds from SIGTERM to SIGKILL to 90 seconds?

So the question is:

Assuming we get the SIGTERM signal, which is not guaranteed

Is there a setting some where in Google control panels where the time between a SIGTERM and actual shutdown can be increased?

Simson
  • 3,373
  • 2
  • 24
  • 38
  • Needless to say my experience with this cloud run is limited, feel free to point me to a duplicate question which I did not find ;-) – Simson Jun 14 '23 at 00:56
  • Cloud Run is not an operating system. Cloud Run applications respond to events such as Pub/Sub or HTTP requests and end when the response is returned. Review the [lifecycle](https://cloud.google.com/blog/topics/developers-practitioners/lifecycle-container-cloud-run) of a request. Take a look at [Cloud Run Jobs](https://cloud.google.com/run/docs/create-jobs) Your post does not have enough information to know which service would fit best. If you have a traditional application design, Compute Engine is a good choice even for containers. – John Hanley Jun 14 '23 at 02:45
  • @JohnHanley yes I know that, my application will trigger on pubsub events but I didn't think that was important for my question. The application is currently running on Compute Engine but that information is also not needed for the minimal reproducible example. If there was any wording above which is not clear or misused in this context please let me know so we can improve the question. – Simson Jun 14 '23 at 03:37
  • @JohnHanley thanks, but the question is not about which service is the best fit, it is about if extending the 10 second shutdown time is possible or not. – Simson Jun 14 '23 at 03:40
  • The idle state is probably what I'm looking for in the second part of the question. – Simson Jun 14 '23 at 03:48
  • 1
    Read some of my comments in the Q&A that you reference. With Cloud Run there is no shutdown time that you control and your container can be killed at any time. Your app returns a response and is done. Think of it as an HTTP request and response with a web server. You can enable always-on CPU so that there can be background processing at an increased cost. Also, keep in mind that your app should be stateless as requests can arrive at a different instance. – John Hanley Jun 14 '23 at 04:51
  • There was one close vote asking for clarification, which makes no sense to me, so I guess the answer is No there is not. – Simson Jun 16 '23 at 00:56

1 Answers1

0

No it is not possible

All entries in the documentation only reefer to this grace time only as 10 seconds there are never any indications it could be reconfigured

Simson
  • 3,373
  • 2
  • 24
  • 38