Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Professional Cloud Developer practice bank has an additional 608 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
Your team manages a stateless Python microservice on Cloud Run using a Cloud Deploy pipeline. Currently, the service uses the default concurrency of 80 requests per instance, causing memory exhaustion under load because the container exceeds its thread pool capacity.
You must deploy an updated container image and meet these requirements:
Which approach should you take?
gcloud run deploy --source alongside a service.yaml specifying concurrency 8 and THREADS=8, and set automaticTrafficControl: false in Cloud Deploy so Cloud Run automatically increments traffic.gcloud run deploy --source with automaticTrafficControl: false doesDeploying with gcloud run deploy --source uses Cloud Build and Google Cloud's buildpacks to package local source code into a container image and deploy it directly to Cloud Run. Setting automaticTrafficControl: false disables Cloud Deploy's automated traffic-splitting orchestration.
service.yaml incompatibility with source deploys: A Cloud Run service.yaml cannot be used when deploying from source because the Knative specification requires the path to a prebuilt container image.25%, 50%, and 75% increments on its own. Setting automaticTrafficControl: false stops Cloud Deploy from managing the split; instead, Cloud Run routes 100% of traffic to the latest healthy revision as soon as possible by default.Procfile or language defaults for entrypoints rather than service.yaml manifests.automaticTrafficControl: true.You were performing a rapid single-environment deployment directly from local Python source code without service.yaml and did not need Cloud Deploy to manage progressive canary traffic shifts.
In CI/CD pipelines with Cloud Deploy, best practice is to build the container image once (for example, in Artifact Registry) and reference that image in service.yaml with automaticTrafficControl: true.
gcloud run services update with --concurrency=1 and THREADS=8 to isolate every request on its own instance while preserving existing settings, and configure Cloud Deploy with percentages: [25, 50, 75, 100] to promote the revision.gcloud run services update with --concurrency=1 doesRunning gcloud run services update creates a new immutable revision by modifying configuration flags while reusing the existing container image. Setting --concurrency=1 forces Cloud Run to route only a single request at a time to each container instance.
1 severely degrades scaling performance because Cloud Run must start a large number of new instances during traffic spikes, increasing cold starts and cost—and making THREADS=8 unnecessary for request concurrency.gcloud run services update updates configuration on the existing container image rather than deploying an updated container image.percentages must not include 100 (such as [25, 50, 75, 100]), because 100% traffic is assumed and handled automatically by the final stable phase.concurrency: 1 removes instance-level request sharing, multiplying container startup overhead under load.gcloud run services update is an imperative configuration change, not a multi-stage canary deployment.You needed to quickly restrict an existing container image to one request per instance without changing the image—for example, as an emergency mitigation for an application with unthread-safe global state.
For Python 3.8+ workloads on Cloud Run, matching THREADS to a moderate concurrency value (like 8) achieves safe parallelism without sacrificing autoscaling efficiency.
service.yaml, update the container image, set concurrency to 8 and THREADS=8 while keeping existing settings and omitting any traffic stanza, and configure the Cloud Deploy pipeline with automaticTrafficControl: true and percentages: [25, 50, 75].Exporting the active Knative-compliant service.yaml (gcloud run services describe SERVICE --format export > service.yaml) captures the complete declarative state of your Cloud Run service, including environment variables, labels, and resource limits. Pairing that complete manifest (without a traffic stanza) with Cloud Deploy's automated canary strategy delegates progressive traffic splitting between the previous stable revision and the new revision directly to the delivery pipeline.
8 and adding the THREADS=8 environment variable aligns the Python runtime's thread pool with the per-instance request limit, preventing memory exhaustion while still sharing CPU and memory across concurrent requests.runtimeConfig.cloudRun.automaticTrafficControl: true and percentages: [25, 50, 75] instructs Cloud Deploy to step traffic through each canary phase before automatically advancing to 100% in the built-in stable phase.service.yaml replaces the entire service template, starting from the exported configuration ensures existing environment variables and labels are retained in the new immutable revision.service.yaml manifest so Cloud Deploy can orchestrate rollouts and rollbacks cleanly.verify, predeploy, postdeploy) at each canary stage.Unlike imperative gcloud CLI flags that inherit unspecified settings, declarative service.yaml deployments drop any setting omitted from the file. Exporting the live specification, modifying only the target fields, and letting Cloud Deploy control traffic is the safest, repeatable GitOps pattern for progressive Cloud Run rollouts.
service.yaml containing only the updated container image, concurrency set to 8, THREADS=8, and a traffic stanza for the canary revision, relying on Cloud Run to preserve unmentioned settings and labels from the previous revision.service.yaml with a traffic stanza doesThis approach writes a stripped-down Knative YAML specification that omits existing service metadata and embeds a static traffic block, assuming Cloud Run merges YAML fields the same way gcloud run deploy command-line flags do.
service.yaml, the new revision is built strictly from the newly deployed YAML. Any environment variables, resource limits, or labels from the previous revision that are absent from the new file are removed.service.yaml without a traffic stanza. Including a traffic block conflicts with Cloud Deploy's dynamic traffic-splitting control between the last stable revision and the new revision.service.yaml represents the full desired state of the service rather than a partial patch.25%, 50%, 75%).You were managing a service directly via gcloud run services replace service.yaml outside Cloud Deploy and intentionally wanted to reset previous settings and labels while defining static revision traffic splits manually.
A common misconception is confusing gcloud run deploy CLI flag inheritance—where unspecified flags retain their previous values—with declarative service.yaml replacement, where omitted fields revert or disappear.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated