Bird
0
0

Your REST API frequently returns 500 Internal Server Error responses due to database connection timeouts. Which strategy is most effective to reduce these errors?

hard📝 Application Q9 of 15
Rest API - HTTP Status Codes
Your REST API frequently returns 500 Internal Server Error responses due to database connection timeouts. Which strategy is most effective to reduce these errors?
AIncrease the client timeout to wait longer for responses
BImplement connection pooling and retry logic for database requests
CReturn a 404 Not Found error instead of 500 to hide server issues
DDisable error logging to improve performance
Step-by-Step Solution
Solution:
  1. Step 1: Identify cause of 500 errors

    Database connection timeouts cause server failures.
  2. Step 2: Choose mitigation strategy

    Connection pooling reduces overhead; retry logic handles transient failures.
  3. Final Answer:

    Implement connection pooling and retry logic for database requests -> Option B
  4. Quick Check:

    Pooling and retries improve reliability and reduce timeouts [OK]
Quick Trick: Use pooling and retries to handle DB timeouts [OK]
Common Mistakes:
  • Increasing client timeout does not fix server-side DB issues
  • Returning 404 hides real server errors and confuses clients
  • Disabling logging prevents diagnosing the root cause

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes