SysPad › Examples › 3-tier web app
3-tier web app
A modern web stack: edge network, load balancer, API on Kubernetes, cache, database, and a payments API.
The basics, plus a grouped Data Layer you can collapse.
- Throughput: 2,000 req/sec
- First to saturate: Nothing at this load
- Estimated cost: $1,278/mo
How it works
- Cloudflare Edge
- The first thing a request meets. Seven in ten are answered here from cache, so everything drawn after it only ever sees the other three.
- Load Balancer
- Spreads requests across the API pods and hides a failed one from users. It also terminates TLS, which is why it sits in the path rather than off to the side.
- API Service
- Where your code runs. How much traffic it holds comes from threads per pod and how long a request takes, not from the instance type: try changing either and rerun the simulation.
- Session Cache
- Session lookups that would otherwise be database reads. At a 90% hit rate the database does a tenth of that work, which is usually the cheapest speed-up available.
- PostgreSQL DB
- The usual bottleneck in a design this shape. Reads can be shared with the replica, but every write lands on the one primary, and that is what runs out first.
- Payments API
- Someone else’s system. Its latency is added to yours and its rate limit becomes yours during a spike, which is why it is worth drawing rather than assuming.