LESSON 10 · Evidence and automation

See and operate the system

Measure the bottleneck before changing the architecture.

SYSTEM VIEW

The architecture

Diagram view
p99 latency—
Cache hit rate—
Database reads—

Watch an alert fire, then follow the signals to the deploy that caused it.

  1. Users’ requests reach the web servers, which answer from the cache and read the database on a miss. The system works, but nothing yet shows how well.

    What changed

    • Requests served
    • Nothing measured yet
  2. Each part reports to monitoring. Centralized logs make errors searchable across servers. Host metrics such as CPU and memory show local pressure, tier metrics show the health of the cache and database fleets, and business metrics such as active users show whether the product serves people.

    What changed

    • Monitoring
    • Logs, host, tier and business metrics
  3. At 14:05, p99 latency, the time within which 99% of requests finish, jumps from 200 ms to 900 ms. Monitoring alerts the team. The cache hit rate and database reads have moved too.

    What changed

    • p99 200 ms → 900 ms
    • Alert at 14:05
    • Hit rate and reads moved
  4. Web CPU is flat, so adding web servers will not help. The web tier is not the constraint; the cause is somewhere else.

    What changed

    • Web CPU flat
    • Adding web servers ruled out
  5. Database reads have risen sixfold because the cache hit rate fell from 95% to 70%. Misses went from 5% of reads to 30%, and every miss goes to the database.

    What changed

    • Misses 5% → 30% of reads
    • Every miss reads the database
  6. A deploy at 14:03, two minutes before the jump, changed the cache key format. The web servers now look up keys in the new format, and more of those lookups miss.

    What changed

    • Deploy at 14:03 found
    • Cache key format changed
    • New-format lookups miss
  7. The fix is a rollback, not a bigger database or more web servers. Rolling back restores the old key format, so the hit rate recovers; adding web servers leaves the hit rate at 70% and database reads six times higher. The automated pipeline ships the rollback to every server the same way.

    Fix
  8. At 1,000 requests a second, a 1 KB log line per request is about 86 GB a day, so teams sample or shorten retention. Logs explain failures; metrics show scale and trends.

    What changed

    • About 86 GB of logs a day
    • Sampling or shorter retention

Space plays · ← → step · Home resets

THE IDEA

How it works

Centralized logs make errors searchable across many servers. Host metrics such as CPU and memory show local pressure; tier metrics show the health of the whole database or cache fleet; business metrics such as active users and retention show whether the product is serving people. Common tools include Prometheus for collecting metrics and Grafana for dashboards.

Evidence shortens an incident. Imagine, as an example, that p99 latency, the time within which 99% of requests finish, jumps from 200 ms to 900 ms at 14:05. Web CPU is flat, so adding web servers will not help. Database reads have risen sixfold, because the cache hit rate fell from 95% to 70%. A deploy at 14:03 changed the cache key format. The fix is a rollback, not a bigger database. Distributed tracing, which records one request’s path through every service, helps when the cause is less obvious.

Automated build, test, and deployment reduce mistakes as the number of servers and regions grows. Use latency, errors, saturation, queue age, and workload shape to decide which tier to change. A rising user count by itself does not prove the database needs sharding.

Monitoring has costs too. At 1,000 requests per second, a 1 KB log line per request is about 86 GB per day, so teams sample or shorten retention. A metric labeled by user ID can create millions of time series and strain the metrics system. A small app can start with error tracking, an uptime check, and a few dashboards.

DECISION POINT

Search has slowed down all week. Web CPU is flat at 30%, database CPU is climbing, and no deploy matches the start of the slowdown.

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

Keep in mind

  • Logs explain failures; metrics show scale and trends.
  • Automation helps keep deployments consistent across servers and regions.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 2
RecallQUESTION 01

Which is a business metric rather than a host metric?

Choose an answer. You’ll see the explanation once you get it right.

Next lesson

0 of 2 checkpoints answered correctly to complete this lesson.