High level architecture
High Level Architecture Deep Dive¶
Overview¶
A good high-level architecture shows clear boundaries, clear ownership, and clear failure domains.
Core Concepts¶
- Stateless compute tier for elasticity.
- Stateful tier optimized for access patterns.
- Async processing for decoupling and smoothing spikes.
Internal Architecture¶
- API gateway handles auth, routing, quotas.
- BFF adapts backend contracts for Android app needs.
- Domain services encapsulate business logic and data ownership.
Data and Request Flow¶
- Read path: Gateway -> BFF -> service -> cache/DB.
- Write path: validate -> persist -> publish event -> downstream processing.
Scalability and Reliability¶
- Use autoscaling for stateless nodes.
- Isolate heavy jobs in worker pools.
- Protect dependencies with budgets, retries, and fallback.
Code Examples¶
[Gateway] -> [BFF] -> [User Service] -> [User DB]
-> [Feed Service] -> [Cache + Feed DB]
Common Interview Questions¶
- Q: Why include a BFF? A: Structure the answer as constraints then tradeoffs: SLOs, capacity assumptions, bottlenecks, failure modes, and mitigation plans with clear triggers.
- Q: How do you split service boundaries? A: Structure the answer as constraints then tradeoffs: SLOs, capacity assumptions, bottlenecks, failure modes, and mitigation plans with clear triggers.
- Q: What is your fallback plan on dependency failure? A: Structure the answer as constraints then tradeoffs: SLOs, capacity assumptions, bottlenecks, failure modes, and mitigation plans with clear triggers.
Production Considerations¶
- Version APIs safely.
- Keep observability at each boundary.
- Prefer gradual migration over big-bang rewrites.
Tradeoffs¶
- Monolith simplicity vs microservice autonomy.
- Fewer services vs independent scaling.
Senior-Level Insights¶
- Boundary quality predicts long-term team velocity.