Repository navigation
feat: batch retry attempt lookups - #1155
Merged
Merged
Conversation
alexluong
force-pushed
the
fix/retry-missing-attempt
branch
from
October 19, 2026 20:01
d1bbd45 to
91ebfb5
Compare
alexluong
force-pushed
the
feat/retry-lookup-batch
branch
from
October 19, 2026 20:01
95be7dd to
758de29
Compare
alexluong
force-pushed
the
fix/retry-missing-attempt
branch
from
October 19, 2026 20:10
91ebfb5 to
09e74e9
Compare
alexluong
force-pushed
the
feat/retry-lookup-batch
branch
from
October 19, 2026 20:10
758de29 to
3e826f6
Compare
alexluong
force-pushed
the
fix/retry-missing-attempt
branch
from
October 19, 2026 20:19
09e74e9 to
0f64b26
Compare
alexluong
force-pushed
the
feat/retry-lookup-batch
branch
from
October 19, 2026 20:20
3e826f6 to
ea47935
Compare
alexluong
marked this pull request as draft
October 19, 2026 20:20
alexluong
force-pushed
the
feat/retry-lookup-batch
branch
from
October 19, 2026 20:24
ea47935 to
ca01ee6
Compare
alexluong
marked this pull request as ready for review
October 19, 2026 20:24
alexbouchardd
approved these changes
Oct 19, 2026
alexluong
force-pushed
the
fix/retry-missing-attempt
branch
from
October 21, 2026 15:33
0f64b26 to
fc2b7e3
Compare
alexluong
force-pushed
the
feat/retry-lookup-batch
branch
from
October 21, 2026 15:34
ca01ee6 to
eb3dad2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Combines the attempt lookups of retries running at the same time into one log store query. Opt-in:
RETRY_LOOKUP_BATCH_SIZE, off by default.Stacked on #1154.
Why
Each retry looks up its previous attempt. On ClickHouse most of a bounded lookup's CPU (~8-10 of ~14 ms) is fixed per-query overhead, so a burst of retries spends most of its cost on overhead. One query for many retries pays it once: ~4 ms per retry at 10 per query, ~1 ms at 100.
Changes
ListLatestAttempts: the latest attempt per (tenant, event, destination), not older than each key's bound.query_plan_max_limit_for_lazy_materializationso payloads are read only for returned rows; servers that reject the setting get the query without it.LATERALoverunnest, one index probe per key.RETRY_LOOKUP_BATCH_WAIT_MSafter the first lookup. Splits a batch whose attempt times span more than 15 min, so one old retry doesn't widen the time range for the rest. A batch of one, and tasks withoutAttemptTime, use the single lookup.RETRY_LOOKUP_BATCH_SIZE(default0= off, max100, capped atRETRY_MAX_CONCURRENCY),RETRY_LOOKUP_BATCH_WAIT_MS(default50).Notes
-shortrun skips the ClickHouse and Postgres suites; they pass locally on ClickHouse 24.10 (without the setting), 25.8 (with it) and Postgres 16.Results
~6,000 retries due within 20 s, ClickHouse 25.8 limited to 3 vCPU:
Setup
ClickHouse 25.8, 3 vCPU, 8 M rows in the attempts table (30 days, ~90 KB average payload). 3 Outpost instances (2 CPU, 2 GiB each), Redis-compatible retry queue, NATS internal queue. Retry schedule
1, 5, 300, 1800, ...s,LOG_BATCH_SIZE=50,LOG_BATCH_THRESHOLD_SECONDS=10,RETRY_VISIBILITY_TIMEOUT_SECONDS=30. 18,000 events (12 KB) in 60 s to one webhook returning 5xx for the first 20 s, then 200. Batching off = #1154. Lookup counts and per-query CPU fromsystem.query_log, container CPU sampled every 5 s over the 320 s run; "during the burst" = samples above 0.2 cores. One run per build.🤖 Generated with Claude Code