Skip to content

perf(valkey): the caches of a process share one Valkey cache tier - #2604

Merged
dan-petty merged 2 commits into
mainfrom
perf/1992-shared-valkey-cache-client
Oct 29, 2026
Merged

dan-petty merged 2 commits into
mainfrom
perf/1992-shared-valkey-cache-client

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The embeddings engine, the Radar client and the library store of devops ai ingest now use one ValkeyCacheTier for each process, shared_cache_tier(). They share one client, one pool and one circuit breaker, so while Valkey is down the process makes one connection attempt in each cooldown, not one for each cache.

  • The tier waits at most DEFAULT_VALKEY_CACHE_CONNECT_TIMEOUT_SECONDS (0.25 s), never more than valkey.timeout, for a connection (valkey-py's socket_connect_timeout). A silent host costs 0.25 s, not 2.0 s for each cache.
  • A tier that cannot be built, for example for a valkey.url that is not valid, gives one warning, and the caches run without Valkey.
  • LibraryVectorStore takes the tier. devops ai ingest no longer imports the private client of devops valkey or pings it.
  • Three except Exception sites go, so three swallowed-failure ceilings fall by one.

Closes #1992

Change: openspec/changes/archive/2026-10-29-1992-shared-valkey-cache-tier/

The embeddings engine, the Radar client and the library store of
`devops ai ingest` use one `ValkeyCacheTier` for each process,
`shared_cache_tier()`. So they share one client, one pool and one
circuit breaker, and an outage costs one connection attempt in each
cooldown for the process. The tier waits at most 0.25 s for a
connection (`DEFAULT_VALKEY_CACHE_CONNECT_TIMEOUT_SECONDS`, never more
than `valkey.timeout`). A tier that cannot be built gives one warning,
and the caches run without Valkey.

`LibraryVectorStore` takes the tier. `devops ai ingest` no longer
imports the private client of the `devops valkey` command or pings it.
@dan-petty

Copy link
Copy Markdown
Owner Author

Test evidence:

Measured on origin/main 6ae7123d (details in the proposal): 3 tiers read a silent Valkey (192.0.2.1:6379) in 6.01 s, 2.0 s each; a loopback connect took at most 0.6 ms, and a cross-node Service connect at most 0.4 ms.

Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).

@dan-petty
dan-petty marked this pull request as ready for review October 29, 2026 02:53
@dan-petty
dan-petty merged commit c778cde into main Oct 29, 2026
16 checks passed
@dan-petty
dan-petty deleted the perf/1992-shared-valkey-cache-client branch October 29, 2026 02:53
dan-petty pushed a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.13.2](v0.13.1...v0.13.2)
(2026-10-29)


### Performance Improvements

* **valkey:** the caches of a process share one Valkey cache tier
([#2604](#2604))
([c778cde](c778cde))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

perf(valkey): the embeddings engine, the threat-intel client and the library store share one fail-soft Valkey client with a short connect timeout

1 participant