Level 8 / Project 10 - Dependency Timeout Matrix¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| — | This project | — | — | Flashcards | — | — |
Focus¶
- Per-dependency timeout configuration with
concurrent.futures - Matrix-style testing across multiple timeout values
- Retry logic with configurable attempt counts
- Health status classification: healthy, degraded, timeout, error
- Optimal timeout analysis from matrix results
Why this project exists¶
Microservice systems depend on many external services — authentication, databases, caches, search indices, notification services — each with different latency profiles. Setting one global timeout (e.g. 30 seconds) is either too generous for fast services or too aggressive for slow ones. This project builds a dependency manager that tests per-service timeouts across a matrix of values, identifies the minimum viable timeout for each dependency, and recommends optimal settings — preventing the cascading failures that bring down entire distributed systems.
Run (copy/paste)¶
Expected terminal output¶
{
"matrix": {"dependencies": [...], "matrix": [...]},
"analysis": {"auth-service": {"min_passing_timeout": 0.05, ...}, ...}
}
7 passed
Expected artifacts¶
- Console JSON output with timeout matrix and analysis
- Passing tests
- Updated
notes.md
Alter it (required)¶
- Add a
--parallelflag that checks all dependencies concurrently usingThreadPoolExecutor. - Add exponential backoff to the retry logic (instead of fixed-interval retries).
- Add a
criticalityfield toDependencyConfigand sort the matrix output by it.
Break it (required)¶
- Set
timeout_seconds=0for a dependency — does the check handle instant timeouts? - Configure a dependency with
max_retries=-1— does it retry forever? - Pass a
health_checkfunction that hangs indefinitely — does the timeout work?
Fix it (required)¶
- Validate that
timeout_seconds > 0andmax_retries >= 0inDependencyConfig. - Add a hard upper limit on retries to prevent infinite loops.
- Add a test for the exponential backoff behavior.
Explain it (teach-back)¶
- Why do microservices need explicit timeout configuration for each dependency?
- How does
ThreadPoolExecutorenable concurrent timeout checks? - What is the difference between a connection timeout and a read timeout?
- Why is a timeout matrix critical for understanding cascading failures?
Mastery check¶
You can move on when you can: - explain why every network call needs a timeout (and what happens without one), - describe cascading failures and how timeouts prevent them, - add a new dependency with custom health check and timeout without looking at docs, - explain retry strategies: fixed, linear, exponential backoff, and jitter.
Related Concepts¶
| ← Prev | Home | Next → |
|---|---|---|