Memory hook: Find the bottleneck before adding capacity.
Must remember
- Correlate CPU, memory, storage latency, IOPS, connection count, locks, replication lag and query latency. A busy CPU and blocked queries require different remedies.
- Use query plans and query insights to find scans, poor selectivity, missing indexes and expensive joins. Indexes improve selected reads but consume space and slow writes; validate changes against the workload.
- Resolve lock contention by shortening transactions, using consistent access order and choosing appropriate isolation. Increasing machine size does not necessarily remove a logical deadlock.
- Scale vertically for per-node resource pressure and horizontally where the engine supports it. Read replicas do not distribute all writes; hot keys can defeat otherwise large capacity.
- Budget compute, storage, backups, network and licenses. Right-size after measuring peaks and growth; check quotas before scaling and maintenance before committing to a savings strategy.
- Automate exports, supported maintenance and upgrades with least privilege, retries, alerting and an owner. Monitor user-facing SLOs as well as database vitals; alert on symptoms with a useful response.
Choose under exam pressure
| Requirement | Choice and reason |
|---|---|
| A query scans millions of rows for one record | Inspect its filter and index plan before upgrading the instance. |
| Writes bottleneck on one key | Redesign the key/access pattern or transaction flow; more replicas may not help. |
Traps
- Every slow query does not need another index.
- An automated task without failure alerts can silently stop protecting data.
Active recall
1. What can high replication lag break?
Fresh reads and recovery objectives that assume recent data.
2. Why inspect locks?
Queries may be waiting on another transaction rather than lacking CPU.
3. What is a useful SLO?
A measurable user-relevant target such as successful database operations within a latency threshold.
4. Why check quotas before an event?
Capacity changes can be blocked even when budget is available.
5. How validate tuning?
Compare representative latency, throughput, error rate and cost before and after.