Skip to content

atenet: add opt-in warm actor route cache - #3823

Draft
Diamond (diamondburned) wants to merge 1 commit into
agent-substrate:mainfrom
diamondburned:feat/safe-warm-route-cache
Draft

Diamond (diamondburned) wants to merge 1 commit into
agent-substrate:mainfrom
diamondburned:feat/safe-warm-route-cache

Conversation

@diamondburned

@diamondburned Diamond (diamondburned) commented Nov 12, 2026 •

Copy link
Copy Markdown

Summary

Every ingress request routed through atenet-router currently invokes ResumeActor on ate-api-server even when the target actor is already running on a known worker, turning warm request routing into control-plane RPC and PostgreSQL load.

  • Adds an opt-in --warm-route-cache-ttl flag (0 by default, Envoy dataplane only) backed by a bounded 65,536-entry LRU cache on ActorResumer.
  • Stamps x-ate-actor-uid on routed requests and verifies it in worker atunnel ingress (ignoring unset "-" placeholders during rolling upgrades) so stale cached routes cannot cross into a recreated actor sharing the same (atespace, name).
  • Enables Envoy ResponseHeaders inspection when --warm-route-cache-ttl > 0: when atunnel responds with HTTP 421 (X-Ate-Assignment-Stale: true in direct H2 mode) or Envoy generates a local reply (including CONNECT tunnel rejections and upstream connection failures), Envoy's external processor evicts the cached route, marks any concurrent ResumeActor flight invalidated so it cannot publish a stale placement, and rewrites direct-H2 421 responses to 503 Service Unavailable (codes.Unavailable for gRPC callers). Application 404/5xx responses from inside the actor lack X-Ate-Assignment-Stale and do not evict the cache.

Verification

  • go test -race -count=3 -shuffle=on ./internal/atenet/... ./internal/atunnel/... ./cmd/atenet/...
  • ./hack/verify/boilerplate.sh && ./hack/verify/gofmt.sh && ./hack/verify/package-deps.sh

🤖 PR was made with the use of generative AI.

Every ingress request through atenet-router currently invokes
ResumeActor on ate-api-server even when the target actor is already
running on a known worker, turning warm request routing into
control-plane RPC and PostgreSQL load.

Add an opt-in --warm-route-cache-ttl flag (default 0, Envoy dataplane
only) backed by a bounded 65,536-entry LRU cache on ActorResumer. To
fence against stale placements and actor recreation under the same name,
stamp x-ate-actor-uid on routed requests and verify it in worker atunnel
ingress (ignoring unset "-" placeholders during rolling upgrades). When
Envoy observes an atunnel 421 with X-Ate-Assignment-Stale: true or an
upstream local reply, ext_proc evicts the cached route, marks any
concurrent resume flight invalidated so it cannot publish a stale
assignment, and rewrites direct-H2 421 responses to 503 Service
Unavailable (gRPC UNAVAILABLE).
@diamondburned Diamond (diamondburned) changed the title atenet/router, atunnel: add opt-in warm route cache with actor UID and stale-assignment fencing atenet: add opt-in warm actor route cache Nov 13, 2026

This branch has not been deployed

No deployments
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.

1 participant