Skip to content

Serve before backfilling - #105

Merged
vitramir merged 1 commit into
mainfrom
serve-before-backfilling
Aug 19, 2026
Merged

vitramir merged 1 commit into
mainfrom
serve-before-backfilling

Conversation

@vitramir

Copy link
Copy Markdown
Contributor

The environment authorization backfill ran between process start and the port opening, and it is one authorization write per environment.

The liveness probe is tcp on the gRPC port — delay=10s timeout=1s period=10s #failure=3 — so a service with enough environments is killed before it finishes, and restarts into the same backfill. A local platform reached that at 121 environments:

Warning  Unhealthy  kubelet  Liveness probe failed: dial tcp 10.42.0.249:50051: connect: connection refused
Normal   Created    kubelet  Created container: agents   (x6 over 5m41s)
agents: backfill environment d6e2de40-…: rpc error: code = Canceled desc = context canceled
agents: backfill environment authorization: list: context canceled

It crashlooped on work that had nothing left to do — every tuple it was writing already existed. The cost is O(environments) on every start, so it gets worse as an organization uses the product.

Nothing waits on it: it is idempotent, it runs again on the next start, and a request arriving while it is in flight is answered by the tuples already there — the same answer it would have got a moment later. So it goes in the background, and the port opens when the service is ready to serve.

The environment authorization backfill ran between process start and the port
opening, and it is one authorization write per environment. The liveness probe
is tcp on the gRPC port -- three failures, ten seconds apart -- so a service
with enough environments is killed before it finishes and restarts into the
same backfill. A local platform reached that at 121 environments and
crashlooped on work that had nothing left to do: every tuple it was writing
already existed.

Nothing waits on it. It is idempotent, it runs again on the next start, and a
request arriving while it is in flight is answered by the tuples already there
-- which is the same answer it would have got a moment later. So it goes in the
background, and the port opens when the service is ready to serve.
@vitramir
vitramir merged commit 4ea63c6 into main Aug 19, 2026
1 of 2 checks passed
@vitramir
vitramir deleted the serve-before-backfilling branch August 19, 2026 16:09
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