Caching and invalidationProLesson 37 of 45, about 8 min
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
The app: Beacon, logs, metrics and traces
Beaconharbor-apiGET /api/plans
p95 latencyno data95 in 100 requests are faster
Cache hit rateno dataanswered from Redis
Postgres queriesno datain the last minute
Redis, Postgres and the code
Redis the cachenot in use
Not in use yet. Every request goes to Postgres.
Postgres the source of truth
plans where id = 'team', price per seat a month
USD 12 EUR 11 GBP 10
api/plans.js the code that runs
1// GET /api/plans?currency=EUR2export async function getPlans(currency) {3 return db.loadPlans(currency); // about 840 ms, every time4}
The MagisterThis is Beacon, Harbor’s metrics, open on GET /api/plans, the call behind the pricing page. Each request runs a slow Postgres query: plans, features and prices per currency. Run a minute of traffic. p95 is the time 95 of every 100 requests come in under.
Step 1 of 8Run a minute of traffic
- Run a minute of traffic
- Tap how many Postgres queries that took
You’re not signed in, so this lesson won’t be saved to your path. Sign in free to keep your XP.