Bird
Raised Fist0
GCPcloud~20 mins

Concurrency and scaling in GCP - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Cloud Concurrency & Scaling Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ service_behavior
intermediate
2:00remaining
How does Google Cloud Run handle concurrency by default?

Google Cloud Run allows you to configure concurrency for your container instances. What is the default concurrency setting for Cloud Run services?

AEach container instance can handle up to 80 concurrent requests by default.
BEach container instance handles exactly 1 request at a time (concurrency = 1).
CEach container instance can handle unlimited concurrent requests by default.
DEach container instance handles 10 concurrent requests by default.
Attempts:
2 left
💡 Hint

Think about how Cloud Run optimizes resource use by handling multiple requests per container.

❓ Architecture
intermediate
2:00remaining
What happens when a Google App Engine Standard environment instance reaches its maximum concurrent requests?

In Google App Engine Standard environment, each instance can handle a limited number of concurrent requests. What does App Engine do when an instance reaches this limit?

AApp Engine queues the extra requests until the instance can handle them.
BApp Engine automatically creates new instances to handle the extra requests.
CApp Engine rejects the extra requests with an error response.
DApp Engine throttles the requests by slowing down the instance.
Attempts:
2 left
💡 Hint

Think about how App Engine scales to handle more traffic.

❓ security
advanced
2:00remaining
Which practice improves security when scaling Google Kubernetes Engine (GKE) clusters under heavy load?

When your GKE cluster scales up to handle more pods, which practice helps maintain security effectively?

AAllow all pods to run with root privileges to avoid permission issues during scaling.
BUse a single node pool with wide permissions for all workloads to simplify management.
CDisable network policies to improve pod communication speed during scaling.
DUse Pod Security Policies or Pod Security Admission to restrict pod permissions consistently.
Attempts:
2 left
💡 Hint

Think about how to keep pods secure even as new ones are added automatically.

❓ Configuration
advanced
2:00remaining
How to configure autoscaling in Google Compute Engine Managed Instance Groups (MIG) based on CPU usage?

You want your MIG to add or remove VM instances automatically based on CPU load. Which configuration snippet correctly sets autoscaling to target 60% average CPU utilization?

Agcloud compute instance-groups managed set-autoscaling my-group --max-num-replicas=10 --min-num-replicas=1 --target-cpu-utilization=0.6
Bgcloud compute instance-groups managed set-autoscaling my-group --max-num-replicas=10 --min-num-replicas=1 --target-cpu-utilization=60
Cgcloud compute instance-groups managed set-autoscaling my-group --max-num-replicas=10 --min-num-replicas=1 --cpu-utilization-target=60
Dgcloud compute instance-groups managed set-autoscaling my-group --max-num-replicas=10 --min-num-replicas=1 --cpu-threshold=0.6
Attempts:
2 left
💡 Hint

Check the correct flag name and value format for CPU utilization target.

🧠 Conceptual
expert
2:00remaining
Why is horizontal scaling often preferred over vertical scaling in cloud environments?

Consider a web application running in the cloud. Why do architects usually prefer horizontal scaling (adding more machines) instead of vertical scaling (adding more power to one machine)?

AVertical scaling allows unlimited resource increase without downtime.
BVertical scaling is cheaper and faster to implement but less reliable.
CHorizontal scaling provides better fault tolerance and can handle more traffic by distributing load.
DHorizontal scaling requires specialized hardware, making it less flexible.
Attempts:
2 left
💡 Hint

Think about what happens if one machine fails in each scaling approach.

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