Skip to content

Tune Redis blocking replay backpressure - #1144

Merged
bootjp merged 1 commit into
mainfrom
feature/redis-blocking-replay-capacity
Jul 22, 2026
Merged

Tune Redis blocking replay backpressure#1144
bootjp merged 1 commit into
mainfrom
feature/redis-blocking-replay-capacity

Conversation

@bootjp

@bootjpbootjp commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • raise the default Redis blocking replay concurrency from 8 to 16
  • shorten BZPOP no-effect replay retries so miss-heavy workloads do not hold workers for seconds
  • drop already-expired async queue work before waiting on worker semaphores

Tests

  • go test ./proxy -count=1
  • go test ./cmd/redis-proxy -count=1
  • golangci-lint run ./proxy ./cmd/redis-proxy --timeout=5m

Summary by CodeRabbit

  • 改善

    • ブロッキングコマンドのセカンダリ処理を最大16件まで並列実行できるようになり、処理性能が向上しました。
    • 効果のないリトライの待機時間を短縮し、不要な再試行を早く終了するよう改善しました。
  • 不具合修正

    • 期限切れのキュー待機処理をセマフォ待ちなしで破棄し、キューの滞留を防止しました。
    • 期限切れタスクのキュー深度や破棄メトリクスが適切に更新されるようになりました。

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@bootjp

Copy link
Copy Markdown
OwnerAuthor

@codex review

@coderabbitai

coderabbitaiBot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@bootjp, you've reached your PR review limit, so we couldn't start this review.

Next review available in:57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3bf2c9fc-d7f8-435a-9c27-de03371ee3ef

📥 Commits

Reviewing files that changed from the base of the PR and between a56e39a and 38d062a.

📒 Files selected for processing (4)
  • cmd/redis-proxy/main_test.go
  • proxy/async_queue.go
  • proxy/dualwrite.go
  • proxy/proxy_test.go
📝 Walkthrough

Walkthrough

非同期キューで期限切れタスクをセマフォ待ちなしに処理し、待機スロットとメトリクス更新を整理します。ブロッキングリプレイの最大並列度を16へ変更し、no-effectリトライ時間枠と関連テストを更新します。

Changes

非同期キュー期限切れ処理

Layer / File(s)Summary
期限切れキュー処理の整理
proxy/async_queue.go, proxy/proxy_test.go
isExpired による二段階判定を追加し、期限切れタスクの待機スロット解放、メトリクス更新、セマフォ解放、ドロップ処理を検証します。

ブロッキングリプレイ設定

Layer / File(s)Summary
並列度・リトライ設定とテスト更新
proxy/dualwrite.go, cmd/redis-proxy/main_test.go, proxy/proxy_test.go
最大並列度を8から16へ変更し、no-effectリトライ時間枠を2秒から500ミリ秒へ短縮します。関連する並列度とリトライ回数の期待値を更新します。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
participant dispatchAsyncQueue
participant asyncTask
participant AsyncQueueMetrics
participant AsyncSemaphores
participant task.fn
dispatchAsyncQueue->>asyncTask: isExpired() を確認
dispatchAsyncQueue->>AsyncQueueMetrics: 待機スロットと遅延を更新
dispatchAsyncQueue->>AsyncSemaphores: 期限切れ時にセマフォを解放
dispatchAsyncQueue->>task.fn: 有効なタスクのみ起動
Loading

Possibly related PRs

  • bootjp/elastickv#1134: 非同期キューの期限切れ処理とセカンダリ並列度の関連変更です。
  • bootjp/elastickv#1142: ブロッキングリプレイの並列度と関連テストを扱っています。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedRedisのblocking replayのバックプレッシャー調整という主題を、並列度増加とリトライ短縮の変更が適切に表しているため。
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bootjp
bootjpforce-pushed the feature/redis-blocking-replay-capacity branch from a56e39a to 38d062aCompareJuly 22, 2026 15:49
@bootjp

Copy link
Copy Markdown
OwnerAuthor

Adjusted the default blocking replay concurrency to 20 so it matches the live tuning point, while keeping the shorter no-effect replay window to reduce secondary pressure.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit:38d062ad00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bootjp
bootjp merged commit 0e80da4 into mainJul 22, 2026
10 checks passed
@bootjp
bootjp deleted the feature/redis-blocking-replay-capacity branch July 22, 2026 16:02
Sign up for freeto 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

@bootjp