feat(relay): make Redis pool size configurable, default 16#2521
Merged
Conversation
deadpool-redis defaults its pool max to CPU_COUNT * 2, which on a 2-vCPU relay pod is only 4 connections shared by rate limiting, presence, pub/sub publishes, and cache invalidation. bb-public pods started showing pool waiters (buzz_redis_pool_waiting > 0, buzz_redis_pool_max = 4) at ~190 events/s. Raise the default to 16 and expose BUZZ_REDIS_POOL_SIZE for per-deploy tuning. Zero or unparsable values fall back to the default. Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
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.
Why
bb-public relay pods started showing Redis pool waiters today (
buzz_redis_pool_waitingpeaked at 2,buzz_redis_pool_availablemin 1) at ~190 events/s — first waiters since launch day.Root cause: we never configure the deadpool-redis pool size, so it uses deadpool's default of
CPU_COUNT * 2. On a 2-vCPU relay pod that's 4 connections, shared by rate-limit checks, presence, pub/sub publishes, NIP-98 replay guard, and cache invalidation. Confirmed live: every bb-public pod reportsbuzz_redis_pool_max = 4.What
BUZZ_REDIS_POOL_SIZEenv var (relay), default 16 when unset; zero/unparsable values fall back to the default.main.rs(the only production pool construction; test-only pools untouched)..env.exampledocuments it.Minimal by design: 16 per pod × 5 pods = 80 Redis connections vs ElastiCache's 65k ceiling — noise for the server, but 4× more headroom where the waiters showed up. No chart change needed; ops can tune per-deploy via env.
Testing
defaults_are_validasserts the 16 default.cargo test -p buzz-relay: 735 passed, 1 failed —api::mesh_demo::tests::demo_join_forwarded_arm_round_trips_echo, which fails identically on cleanorigin/mainat the same SHA (pre-existing, known flake).cargo clippy -p buzz-relay --all-targetsclean,cargo fmtclean.Observability
Watch
block.buzz_relay.buzz_redis_pool_maxflip 4 → 16 on rollout, andbuzz_redis_pool_waitingstay at 0.