Five production incidents. Read the metrics, the slow-query log and the query plan, name the root cause, then fix it within budget. Buying hardware you did not need costs points.
Helpful first: How a query runs, Connection pooling and CQRS.
1
Order history crawls
2
The feed that asks 101 questions
3
Too many clients
4
Launch-day catalogue
5
The 01:00 freeze
This morning's release added an order-history page. Since then it takes two seconds to load and database CPU is pinned near 100%. Traffic is the same as yesterday.
budget $200/month · all numbers illustrative
Order history p952.0 s
target 300 msover the line
Database CPU97%
alert at 80%over the line
Rows read per second121 M
Page requests per second25/s
avg 1.9 s26/snew in today's release
SELECT * FROM orders WHERE customer_id = $1 ORDER BY created_at DESC LIMIT 20
Limit (actual time=1874.1..1874.2 rows=20) -> Sort (actual time=1874.1..1874.1 rows=20) Sort Key: created_at DESC -> Seq Scan on orders (actual time=3.2..1873.6 rows=48) Filter: (customer_id = 81723) Rows Removed by Filter: 4812377Execution Time: 1874.5 ms
One answer. Symptoms are not causes.
Pay only for what the diagnosis justifies. Extras cost points.
spent $0/monthof $200
Pick a root cause and at least one fix.