We are running kafka consumer as Cloud Run service
The problem is that the new revision with the new code does not shut down old revision, it just switches traffic (useless for background job type of service). Old revisions are turned off by SIGTERM signal from Cloud Run after ~5-20 minutes, which is too long, because for all that time old consumer is working and consuming events, instead of the new one
Any workaround here?
Hi @PavelKulikov,
Welcome to Google Cloud Community!
There is currently no built in feature in cloud run where you can immediately/abruptly shutdown your old revisions whenever you deploy new revisions.
As documented, Cloud Run sends a SIGTERM signal before it terminates an instance, this is done so users can gracefully terminate their applications. SIGTERM signals are sent in the event that there is a scale down or deleted revision.
When a revision does not receive any traffic, by default it is scaled in to zero instances. The approach you can do is to manage your revision, make the latest revision to serve 100% of the traffic. However only new requests will be migrated to the new version as requests currently being processed will continue to completion, referring to this stack overflow answer recommended by Google,
Cloud Run will continue to handle on-going requests on the existing instances of the old revision. The instances on the old revision will only shutdown once all requests are handled and be idle for about 15 minutes. Only the new requests will be routed to the new revision.
Hi anjelisa, I'm having the same trouble as @PavelKulikov.
Is the feature for immediately shutting down old reivisions included in the roadmap?
Thanks in advance.