Skip to content

podcertcontroller: do not rate-limit PCRs assigned to other replicas - #2353

Merged
Taahir Ahmed (ahmedtd) merged 3 commits into
agent-substrate:mainfrom
chw120:podcert-rate-limiter
Oct 9, 2026
Merged

Taahir Ahmed (ahmedtd) merged 3 commits into
agent-substrate:mainfrom
chw120:podcert-rate-limiter

Conversation

@chw120

Copy link
Copy Markdown
Collaborator

Summary

Every replica receives every PodCertificateRequest, but only the replica chosen by rendezvous hashing should sign it. The others return ErrNotAssigned and were requeued with AddRateLimited, which treats a normal condition as a failure:

  • consumes the shared failure rate limiter (10 QPS bucket), and
  • grows the per-item exponential backoff (up to 1000s).

This slows retries of genuinely assigned PCRs and delays takeover when a replica dies (the PCRs it owned may already be deep in backoff on the surviving replicas).

Unassigned PCRs are now requeued with AddAfter(rendezvous.LeaseDuration). Assignments only change when a replica joins or its lease expires, so re-checking more often gains nothing. LeaseDuration is exported from rendezvous for this purpose; its value is unchanged.

A follow-up could make this event-driven (re-enqueue pending PCRs when the active replica set changes) instead of polling.

Testing

go test ./cmd/podcertcontroller/...

  • Tests pass
  • Documentation updated (n/a)

Every replica receives every PodCertificateRequest, but only the replica
chosen by rendezvous hashing should sign it. The others returned
ErrNotAssigned and requeued with AddRateLimited, which treats a normal
condition as a failure: it consumes the shared failure rate limiter and
grows the per-item exponential backoff (up to 1000s), slowing down
retries of genuinely assigned PCRs and delaying takeover when a replica
dies.

Requeue unassigned PCRs with AddAfter instead, using the rendezvous
lease duration as the recheck interval since assignments cannot change
faster than that.
@chw120

Copy link
Copy Markdown
Collaborator Author

Thanks Taahir Ahmed (@ahmedtd) for the quick review. I have fixed the comment. Please review it again.

@ahmedtd
Taahir Ahmed (ahmedtd) added this pull request to the merge queue Oct 9, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 9, 2026
@ahmedtd
Taahir Ahmed (ahmedtd) added this pull request to the merge queue Oct 9, 2026
Merged via the queue into agent-substrate:main with commit 1539834 Oct 9, 2026
14 checks passed
@chw120
Chenyi Wang (chw120) deleted the podcert-rate-limiter branch October 9, 2026 23:28
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.

2 participants