Debugging / Latency split
Slow Queries
Before tuning anything, split the time you measured into network and server time. That one number tells you where to look.
Measure first
Split the latency
A query response reports its own retrieval time. Compare it with the duration you measured around the call — the difference is everything that is not retrieval.
Outside the server
720 ms
Share of total
80%
Most of the time is outside the server: look at network path, TLS handshakes, connection reuse, and your own serialization.
Fixes
What actually reduces it
- Ask for fewer results
- Lower k. Most prompts use only the first few memories, and a smaller result set is cheaper to assemble and to send.
- Narrow with filters
- Tag filters reduce the candidate set instead of ranking a larger one.
- Reuse connections
- A fresh TLS handshake per call is a common cause of latency that looks server-side but is not.
- Cache identical queries
- Only where you can key by scope and invalidate on write — see the caching guide.
- Bound the call
- A deadline shorter than your user-journey budget keeps a slow call from becoming a slow page.
Was this page helpful?