A Meziantou post walks through a slow /carts request spanning a storefront, a Redis cache and a catalog API, investigated with Aspire's MCP server and CLI. The telemetry exposes a cache that never answers, plus an agent report that is only half right.
Key points
- Aspire MCP server and the aspire CLI drive the work: trace listing, span table and per-trace structured logs.
- In the slowest trace seven catalog calls take 368 of 383 ms, while each Redis HMGET costs about a millisecond.
- Root cause: ProductCacheDuration is documented in seconds but read as milliseconds, so entries expire at once.
- RedisCache rounds the TTL down to whole seconds, so 600 ms became `EXPIRE ... 0` and the key vanished immediately.
- After `TimeSpan.FromSeconds`, p50 fell from 249 ms to 5 ms and p95 from 358 ms to 8 ms.
- Telemetry quirks: Redis spans export late, carry no key, and the table clock differs from the JSON clock.
Why it matters
The real value here is less the TTL bug than the method: a question, a trace, the logs, then a hypothesis the telemetry can actually test. If your team lets agents propose fixes, make that loop mandatory — an explanation that merely fits the symptom is the shortest path to merging a wrong theory.
One platform detail deserves a place in your notes: Microsoft.Extensions.Caching.StackExchangeRedis rounds sub-second expirations down to zero, so very short TTLs mean no caching at all, and binding the setting as a TimeSpan removes the unit confusion entirely. Keep the fix that removes the cause separate from the refactor that improves the design, otherwise you lose the evidence.
Real-world use
- A web shop cart page that reads each product through an IDistributedCache backed by Redis.
- A single slow user request that fans out across storefront, Redis and a catalog API.
- Checking an AI agent's root-cause report against traces and logs before merging the fix.
This summary was generated by the agent from the original post on Gérald Barré (Meziantou's blog). The full text and all rights belong to its author and publisher. Go to original