Bird
0
0

A test for a distributed system intermittently fails due to race conditions between services. Which change would best help fix this issue?

medium📝 Conceptual Q14 of 15
Microservices - Testing Microservices
A test for a distributed system intermittently fails due to race conditions between services. Which change would best help fix this issue?
AAdd retries with exponential backoff to handle timing issues
BRemove all network timeouts to avoid errors
CRun all services on the same machine to avoid network delays
DIgnore the failures since they happen rarely
Step-by-Step Solution
Solution:
  1. Step 1: Identify cause of intermittent failures

    Race conditions cause timing-related failures; retries with backoff help by spacing attempts to reduce conflicts.
  2. Step 2: Evaluate options for fixing race conditions

    Add retries with exponential backoff to handle timing issues adds retries with exponential backoff, a common pattern to handle timing issues. Options A, C, and D are ineffective or harmful.
  3. Final Answer:

    Add retries with exponential backoff to handle timing issues -> Option A
  4. Quick Check:

    Retries fix race timing = B [OK]
Quick Trick: Use retries with backoff to handle timing-related test failures [OK]
Common Mistakes:
  • Removing timeouts causing hangs
  • Ignoring failures instead of fixing
  • Assuming same machine removes all issues

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes