Bird
Raised Fist0
GCPcloud~10 mins

Concurrency and scaling in GCP - Interactive Code Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the instance class in a Google App Engine service.

GCP
instance_class: [1]
Drag options to blanks, or click blank then click option'
Aauto
Bmanual
Cstandard
DF2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'standard' which is a service environment, not an instance class.
Using 'auto' or 'manual' which are scaling types, not instance classes.
2fill in blank
medium

Complete the code to set automatic scaling in App Engine.

GCP
automatic_scaling:
  max_instances: [1]
Drag options to blanks, or click blank then click option'
A10
B5
C0
Dunlimited
Attempts:
3 left
💡 Hint
Common Mistakes
Setting max_instances to 0 disables instances, causing errors.
Using 'unlimited' is not a valid numeric value.
3fill in blank
hard

Fix the error in the Cloud Run service configuration to allow concurrency of 80 requests per instance.

GCP
concurrency: [1]
Drag options to blanks, or click blank then click option'
A80
B1
C1000
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Setting concurrency to 0 disables concurrency, causing errors.
Using 1 disables concurrency, allowing only one request at a time.
4fill in blank
hard

Fill both blanks to configure App Engine to use manual scaling with 3 instances.

GCP
manual_scaling:
  instances: [1]
env: [2]
Drag options to blanks, or click blank then click option'
A3
Bstandard
Cflexible
Dauto
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'auto' environment which is not valid.
Setting instances to a non-integer value.
5fill in blank
hard

Fill all three blanks to create a Cloud Run service with max instances 5, concurrency 10, and CPU always allocated.

GCP
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: my-service
spec:
  template:
    spec:
      containerConcurrency: [1]
      container:
        image: gcr.io/my-project/my-image
        resources:
          limits:
            cpu: 1
        env:
          - name: CPU_ALWAYS_ON
            value: "[2]"
      maxScale: [3]
Drag options to blanks, or click blank then click option'
A5
Btrue
C10
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up concurrency and maxScale values.
Using 'false' for CPU_ALWAYS_ON disables always-on CPU.

Practice

(1/5)
1. What does concurrency control in a Google Cloud service primarily manage?
easy
A. The network bandwidth available to the service
B. The total number of instances running
C. The number of requests one instance can handle at the same time
D. The amount of storage used by the service

Solution

  1. Step 1: Understand concurrency meaning

    Concurrency means how many tasks or requests can happen at once in one place.
  2. Step 2: Apply concurrency to cloud instances

    In cloud services, concurrency controls how many requests a single instance handles simultaneously.
  3. Final Answer:

    The number of requests one instance can handle at the same time -> Option C
  4. Quick Check:

    Concurrency = requests per instance [OK]
Hint: Concurrency = requests per instance at once [OK]
Common Mistakes:
  • Confusing concurrency with total instances
  • Thinking concurrency controls storage or bandwidth
  • Mixing concurrency with scaling
2. Which of the following is the correct way to set maximum concurrency to 10 in a Google Cloud Run service using gcloud CLI?
easy
A. gcloud run services create SERVICE --max-concurrency=10
B. gcloud run services update SERVICE --concurrency=10
C. gcloud run services update SERVICE --max-instances=10
D. gcloud run services update SERVICE --concurrency-limit=10

Solution

  1. Step 1: Identify correct flag for concurrency

    The correct flag to set concurrency in Cloud Run is --concurrency.
  2. Step 2: Use update command for existing service

    To change concurrency, use 'gcloud run services update SERVICE --concurrency=10'.
  3. Final Answer:

    gcloud run services update SERVICE --concurrency=10 -> Option B
  4. Quick Check:

    Concurrency flag is --concurrency [OK]
Hint: Use --concurrency flag with update command [OK]
Common Mistakes:
  • Using --max-concurrency which is invalid
  • Confusing concurrency with max-instances
  • Trying to set concurrency on service creation instead of update
3. Consider a Cloud Run service with max concurrency set to 5 and max instances set to 3. If 20 requests arrive simultaneously, how many instances will be used to handle the load?
medium
A. 5 instances
B. 4 instances
C. 20 instances
D. 3 instances

Solution

  1. Step 1: Calculate needed instances for 20 requests with concurrency 5

    Each instance can handle 5 requests at once, so 20 requests need 20/5 = 4 instances.
  2. Step 2: Apply max instances limit

    The max instances is set to 3, so the service cannot create more than 3 instances.
  3. Final Answer:

    3 instances -> Option D
  4. Quick Check:

    Max instances limit caps instance count [OK]
Hint: Max instances limit caps scaling even if more needed [OK]
Common Mistakes:
  • Ignoring max instances limit and choosing 4
  • Confusing concurrency with max instances
  • Assuming one instance per request
4. You set concurrency to 80 on a Cloud Run service, but your app crashes under load. What is the most likely cause?
medium
A. The app cannot handle that many requests at once causing resource exhaustion
B. The max instances setting is too low
C. The service is not deployed in the right region
D. The concurrency setting must be at least 100

Solution

  1. Step 1: Understand concurrency impact on app

    High concurrency means many requests handled simultaneously by one instance, increasing resource use.
  2. Step 2: Link app crash to resource limits

    If the app crashes, it likely cannot handle that many requests at once, causing memory or CPU overload.
  3. Final Answer:

    The app cannot handle that many requests at once causing resource exhaustion -> Option A
  4. Quick Check:

    Too high concurrency can crash app [OK]
Hint: High concurrency can overload app resources [OK]
Common Mistakes:
  • Blaming region instead of concurrency
  • Assuming concurrency must be at least 100
  • Ignoring app resource limits
5. You want your Cloud Run service to handle sudden traffic spikes efficiently without wasting resources during low traffic. Which combination of settings is best?
hard
A. Set concurrency to a moderate number (e.g., 10) and allow max instances to scale high
B. Set concurrency to 1 and max instances to 1
C. Set concurrency very high (e.g., 100) and max instances low (e.g., 2)
D. Disable concurrency and fix max instances to 10

Solution

  1. Step 1: Balance concurrency and scaling for efficiency

    Moderate concurrency lets each instance handle multiple requests, saving resources.
  2. Step 2: Allow max instances to scale high for spikes

    High max instances lets the service add instances when traffic spikes, keeping performance.
  3. Final Answer:

    Set concurrency to a moderate number (e.g., 10) and allow max instances to scale high -> Option A
  4. Quick Check:

    Moderate concurrency + high max instances = efficient scaling [OK]
Hint: Moderate concurrency + high max instances for spikes [OK]
Common Mistakes:
  • Setting concurrency too low wastes instances
  • Setting concurrency too high risks crashes
  • Fixing max instances limits scaling
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard