A cache hit is only part of the story
The first data-path checks in a tiny API lab, and the latency questions I want to ask next.
Start with a visible request path
The service lab has a short path to follow: a Python API, PostgreSQL for records, and Redis for a 60-second read cache.
Creating an item writes it to PostgreSQL. The first read retrieves it from the database and stores a cached copy. A second read can return the cached record. The response includes a source field so the route is easy to see while experimenting.
The setup checks passed for readiness, a database write/read, and a cache miss followed by a hit.
What the checks establish
These checks establish a working data path. They are a useful foundation for the questions that follow:
- How does latency change as requests overlap?
- Where does a request wait when a connection is unavailable?
- What happens when Redis is slow or unavailable?
- How does the database behave after a burst of cache misses?
“Çalışıyor” iyi bir başlangıç. Yük altında ne olduğunu da görmek istiyorum.
Make dependencies observable
The API exposes a few small surfaces:
| Endpoint | Purpose |
|---|---|
/live | Check whether the API process responds. |
/ready | Check the database and cache dependencies. |
/metrics | Export request counters, latency histograms, and cache outcomes. |
If the cache cannot be reached, the read path attempts the database. The readiness response reports dependency health separately. That distinction will be useful when I deliberately interrupt a dependency and watch recovery.
The next experiment
The next run should combine a defined workload with the observations around it. I want to keep request timing, cache outcomes, and dependency behavior in the same note.
The sequence is simple:
- Establish a repeatable baseline workload.
- Run it with the cache available.
- Interrupt the cache and repeat the workload.
- Restore the dependency and observe the recovery.
The lab includes a short load-test script, but this entry does not yet report a latency comparison. The results will need the workload, environment, and raw measurements alongside them.
Context: the small lab.
Small experiments. Honest notes.