Lessons › From one user to millions
Ready for launch
The design holds up at 5,000 req/s. But nobody can reach it by name, nothing blocks attacks, the passwords are in the code, and if it breaks at 3 a.m. you'd hear about it from your users.
Play this levelFree with an account. It runs in your browser: build the design, press Run, and watch what breaks.
The lesson
None of these parts make your app faster. They decide how fast you find out something's wrong, and how fast you fix it.
DNS turns your name into an address, and a firewall drops bad traffic before it costs you anything. Both are cheap compared to what they prevent.
Metrics tell you that something is wrong. Logs tell you what happened. Traces show which service made one request slow. You want all three, and they're sent aside, so users never wait for them.
Secrets belong in a secrets store, not in git. Coordination such as etcd or ZooKeeper is how machines agree on a leader: run 3 or 5, and keep it small.
What you have to achieve
5,000 requests a second at the busiest hour, 5% of them writes.
- No broken or illegal connections
- Use DNS
- Use a Firewall (WAF)
- Use Monitoring
- Use Logging
- Use Tracing
- Use Secrets & Config
- Use Coordination with at least 3 instances
- No component is overloaded
- p99 response time under 200 ms
What you learn
Open "Where the money goes": the firewall, logs and traces now cost more than all your machines. That's a common surprise in real companies, and the reason teams log less at high traffic and keep a small sample of traces.
Check yourself
Metrics, logs and traces: which shows which service made one request slow?
- Traces
- Metrics
- Logs
Show the answer
Traces. Metrics say something is wrong, logs say what happened, and traces follow one request across services.
Where do passwords and API keys belong?
- In the code
- In a secrets store
- In the database
Show the answer
In a secrets store. Anything in git can leak. A secrets store keeps them out of the code and lets you rotate them.