Cache invalidation: Price changes don't show up for customers
Cache invalidation debugging lab. The pricing team changes a price, the database has it, and customers keep seeing the old one.
Practice debugging a cache invalidation in a live, broken production system in your browser, with Redis and PostgreSQL. Find the root cause in the logs, terminal and code, fix it, and a load test checks that the fix holds under real traffic.
1. The Incident Context
The pricing team pushed a round of price changes at 16:03. The admin tool confirmed each one, but customers are still being charged the old prices, and support is forwarding screenshots that don't match the database. Some changes appear by themselves after a while, others don't seem to apply at all.
2. Observed Symptoms & Metrics
- Affected Endpoints / Components:
PUT /products/{id} and GET /products/{id} on the catalog service, Redis product:{id} keys, Postgres products table.
- Behavior:
PUT /products/{id} returns 200 with the new price, and Postgres stores it. Reads of the same product right afterwards return the old price, sometimes for up to 10 minutes.
- Error Rate: HTTP looks clean, with no 5xx responses. The data customers see is wrong.
- System Metrics: Redis hit rate is close to 100%, and latency is excellent. Postgres load is low.
3. Application Logs
2026/10/12 16:03:02 catalog service listening on :8080
$ curl -s -X PUT localhost:8080/products/1 -H 'Content-Type: application/json' -d '{"price": 42.5}'
{"id":1,"name":"Product 1","price":42.5}
$ curl -s localhost:8080/products/1
{"id":1,"name":"Product 1","price":11}
$ psql "$DATABASE_URL" -c "SELECT price FROM products WHERE id = 1"
price
-------
42.50
4. Your Objective
Step into the live environment while synthetic traffic is running, diagnose the root cause, and patch the codebase.
To clear this stack, your fix must satisfy these automated verification checks under a 60-second load test:
- Error Rate: Fewer than 1% of requests fail (
http_errors < 1%).
- Performance: P99 latency stays below 200 ms (
p99_latency_ms < 200).
- Data Integrity: Every read right after a price change returns the new price (
failed_checks <= 0).
Toolbox: curl -X PUT localhost:8080/products/1 -H 'Content-Type: application/json' -d '{"price": 42.5}', curl localhost:8080/products/1, redis-cli get product:1, redis-cli ttl product:1, psql "$DATABASE_URL". Save a file in the editor to rebuild and restart the app. Click Verify when you think it's fixed.
Your account and data
You can browse stacks without an account. To run labs you sign in with your email or Google account. BustedStack uses your email address to
sign you in, and your name and profile picture to show your account and pre-fill certificates. We never access your Gmail, contacts or Drive,
sell your data or run ad trackers.
Privacy Policy · Terms of Service · Browse stacks ·
hello@bustedstack.com
This site needs JavaScript to run labs.