spec: throttle aggregate Redis fan-out to 12 concurrent - #1289
Merged
Conversation
…ing alphabetically-later specs to timeout as draft)
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.
Root cause found
Homepage "Awaiting samples" persistent state: the aggregate loader fires
Promise.allSettled(specs.map(loadOne))= 68 read chains at once. Each chain does 2-3 Redis GETs (pointer → blob → optional LKG), so ~150-200 concurrent Redis ops per aggregate cycle. SRH's request pool saturates and the alphabetically-later specs (perp-open-interest→zksync-rpc, exactly 31 slugs) systematically time out at 8s and render as draft placeholders, even though their blobs are sitting in Redis the whole time (v=2, correct pointers, valid LKG).Deterministic pattern: sorted slug list, cutoff at
perp-funding-stability/perp-open-interest.Fix
Wrap the fan-out in a small
limitedAllSettled(12 concurrent workers, same result shape asPromise.allSettled). All 68 chains complete in ~4-5 s worst-case wall time instead of 37 completing in 200 ms + 31 timing out.Behind the
unstable_cachelayer (revalidate 300 s) so the slightly-longer cache-miss wall time is invisible to end users. On cache hit (99% of requests) zero difference.Follow-up work still open
Both would replace this throttle but aren't cheap.