Level 9 / Project 05 - Capacity Planning Model¶
Home: README
Learn Your Way¶
| Read | Build | Watch | Test | Review | Visualize | Try |
|---|---|---|---|---|---|---|
| — | This project | — | — | Flashcards | — | — |
Focus¶
- Growth modeling: linear, exponential, and step-function curves
- Strategy pattern for pluggable growth curve selection
- Resource profiling with current usage and capacity limits
- Forecast generation with headroom recommendations
- What-if scenario analysis for capacity decisions
Why this project exists¶
Capacity planning prevents outages by projecting resource needs before demand exceeds supply. A service growing at 15% month-over-month will exhaust its database connections in 8 months — but without a model, the team only discovers this during a production incident. This project models compute, storage, and bandwidth growth using configurable curves and generates capacity forecasts with months-until-exhaustion calculations — the same approach infrastructure teams use at every major tech company.
Run (copy/paste)¶
Expected terminal output¶
{
"resources": [...],
"forecasts": [...],
"months_until_exhaustion": {"compute": 14, "storage": 8, ...}
}
7 passed
Expected artifacts¶
- Console JSON output with capacity forecasts
- Passing tests
- Updated
notes.md
Alter it (required)¶
- Add a
seasonalgrowth function that models periodic spikes (e.g. Black Friday traffic). - Add a
--chartflag that outputs a text-based ASCII chart of the capacity forecast. - Add cost estimation — multiply forecasted usage by per-unit cost to project spend.
Break it (required)¶
- Set
growth_rate=0for exponential growth — does the forecast handle it? - Create a resource profile with
capacity < current_usage— is it flagged as already exhausted? - Pass
months=0toforecast()— does it return an empty forecast or error?
Fix it (required)¶
- Validate that
growth_rate > 0for exponential models. - Add "already exhausted" detection for resources that are over capacity at month 0.
- Validate
months >= 1in the forecast method.
Explain it (teach-back)¶
- What is capacity planning and why is it critical for infrastructure teams?
- How do linear, exponential, and step growth functions differ in real-world modeling?
- What is the "months until exhaustion" calculation and why is it a key metric?
- How do what-if scenarios help teams decide when to add infrastructure?
Mastery check¶
You can move on when you can: - explain the difference between linear and exponential growth forecasting, - run a what-if scenario that compares current vs optimized resource profiles, - describe how capacity planning prevents outages vs reactive scaling, - add a new growth model without modifying existing forecast logic.
Mastery Check¶
- Can you explain the architectural trade-offs in your solution?
- Could you refactor this for a completely different use case?
- Can you identify at least two alternative approaches and explain why you chose yours?
- Could you debug this without print statements, using only breakpoint()?
Related Concepts¶
| ← Prev | Home | Next → |
|---|---|---|