Refer to the exhibit. A payment microservice on GKE logs frequent 'connection closed' errors. The service connects to a backend database. Which approach is most effective to reduce these errors?
Retries handle transient connection closures.
Why this answer
The 'connection closed' errors indicate transient network failures or database server-side connection drops. Implementing retry logic with exponential backoff in the service code is the most effective approach because it allows the microservice to gracefully recover from intermittent failures without overwhelming the database with immediate retries. This pattern is a standard resilience technique for cloud-native applications on GKE, as it handles temporary issues like network blips or database connection pool exhaustion.
Exam trap
Google Cloud often tests the misconception that scaling resources (pods or limits) fixes all performance issues, but here the trap is that 'connection closed' errors are typically transient network or database-side issues, not resource bottlenecks, so retry logic is the correct resilience pattern.
How to eliminate wrong answers
Option B is wrong because increasing pod replicas distributes load but does not address the root cause of transient connection failures; it may even increase the number of concurrent connections, potentially worsening the problem. Option C is wrong because adjusting the readiness probe to be more aggressive (e.g., shorter interval or lower threshold) could cause pods to be prematurely removed from service during brief hiccups, leading to more instability and connection errors. Option D is wrong because increasing CPU and memory limits addresses resource starvation, not transient network or database connection drops; the errors are not caused by insufficient resources but by connection lifecycle issues.