Learn the most efficient way to deploy a new feature into production on Cloud Run while enabling gradual rollout to minimize downtime from code errors. Configure traffic splitting between revisions.
Table of Contents
Question
You need to deploy a new feature into production on Cloud Run. Your company’s SRE team mandates gradual deployments to avoid large downtimes caused by code change errors. You want to configure this deployment with minimal effort. What should you do?
A. Configure the application’s frontend load balancer to toggle between the new and old revisions.
B. Configure the application code to send a small percentage of users to the newly deployed revision.
C. Deploy the feature with “Serve this revision immediately” unchecked, and configure the new revision to serve a small percentage of traffic. Check for errors, and increase traffic to the revision as appropriate.
D. Deploy the feature with “Serve this revision immediately” checked. Check for errors, roll back to the previous revision, and repeat the process until you have verified that the deployment is bug-free.
Answer
C. Deploy the feature with “Serve this revision immediately” unchecked, and configure the new revision to serve a small percentage of traffic. Check for errors, and increase traffic to the revision as appropriate.
Explanation
When deploying a new revision on Cloud Run, leaving the “Serve this revision immediately” option unchecked allows you to gradually shift traffic from the old revision to the new one. This is the simplest way to perform a gradual rollout that minimizes the blast radius of any bugs in the new code.
After deploying with this option unchecked, the new revision will be created but will not receive any production traffic yet. You can then configure Cloud Run to send a small percentage of traffic, say 5%, to the new revision. This allows you to test it with a subset of real users and requests.
Monitor the new revision closely for any errors or issues. If everything looks good, you can progressively increase the proportion of traffic it receives until it is serving 100%. If problems arise, you can easily shift traffic back to the old stable revision.
The other options are not ideal:
A) Manually toggling traffic at the load balancer level is error-prone and doesn’t provide granular % based splitting.
B) Having the application route users is complex and violates the principle of separation of concerns.
D) Repeatedly serving new revisions immediately risks exposing many users to errors and requiring full rollbacks.
So in summary, using Cloud Run’s built-in gradual traffic shifting functionality by deploying with “Serve this revision immediately” unchecked is the easiest and most robust way to slowly roll out the new feature and catch any issues early.
Google Professional Cloud Developer certification exam assessment practice question and answer (Q&A) dump including multiple choice questions (MCQ) and objective type questions, with detail explanation and reference available free, helpful to pass the Google Professional Cloud Developer exam and earn Google Professional Cloud Developer certification.