Bird
0
0

Which approach correctly combines error handling and retries?

hard🚀 Application Q15 of 15
DynamoDB - with AWS SDK
You want to implement a retry mechanism for DynamoDB writes that retries up to 3 times with exponential backoff when a throttling error occurs. Which approach correctly combines error handling and retries?
AUse a loop with try-except catching throttling errors, sleep doubling wait time each retry, stop after 3 attempts
BCall put_item once, then retry infinitely without delay on any error
CIgnore errors and assume writes always succeed
DUse try-except but do not check error codes before retrying
Step-by-Step Solution
Solution:
  1. Step 1: Understand retry with exponential backoff

    Retries should be limited in number and wait time should increase to reduce load.
  2. Step 2: Combine error handling and retry logic

    Use a loop with try-except to catch throttling errors, sleep with increasing delay, and stop after max retries.
  3. Final Answer:

    Use a loop with try-except catching throttling errors, sleep doubling wait time each retry, stop after 3 attempts -> Option A
  4. Quick Check:

    Retry loop + exponential backoff + error check = Use a loop with try-except catching throttling errors, sleep doubling wait time each retry, stop after 3 attempts [OK]
Quick Trick: Retry with limited attempts and increasing delay on throttling [OK]
Common Mistakes:
MISTAKES
  • Retrying infinitely without delay
  • Not checking error codes before retrying
  • Ignoring errors completely

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes